Skip to content

Instantly share code, notes, and snippets.

@butlermh
Created June 29, 2011 11:05
Show Gist options
  • Save butlermh/1053648 to your computer and use it in GitHub Desktop.
Save butlermh/1053648 to your computer and use it in GitHub Desktop.
Nested boolean queries for ElasticSearch
{
"bool":{
"must":[
{
"query_string":{
"default_field":"content",
"query":"test1"
}
},
{
"query_string":{
"default_field":"content",
"query":"test4"
}
}
],
"must_not":{
"query_string":{
"default_field":"content",
"query":"test2"
}
},
"should":{
"query_string":{
"default_field":"content",
"query":"test3"
}
}
}
}
@imtiazahmad007
Copy link

This is not nested is it? It's the outer level for what is contained inside a bool query

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment