Created
November 1, 2014 23:14
-
-
Save jprante/ed6a78a4cee6fdf33b7f to your computer and use it in GitHub Desktop.
Must/should filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XDELETE 'localhost:9200/test' | |
curl -XPUT 'localhost:9200/test/test/1' -d ' | |
{ | |
"location" : "germany", | |
"valueType" : "integer" | |
} | |
' | |
curl -XGET 'localhost:9200/test/_refresh' | |
curl -XGET 'localhost:9200/test/_search?pretty' -d ' | |
{ | |
"query": { | |
"bool": { | |
"must": { | |
"terms": { "location": ["germany" ]} | |
}, | |
"should": { | |
"terms": { "valueType": ["integer"] } | |
} | |
} | |
} | |
} | |
' | |
curl -XGET 'localhost:9200/test/_search?pretty' -d ' | |
{ | |
"query": { | |
"filtered": { | |
"query": { | |
"match_all": {} | |
}, | |
"filter": { | |
"bool": { | |
"must": { | |
"terms": { "location": ["germany"] } | |
}, | |
"should": { | |
"terms": { "valueType": ["integer"] } | |
} | |
} | |
} | |
} | |
} | |
} | |
' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment