Skip to content

Instantly share code, notes, and snippets.

@rafaelfelini
Created October 11, 2013 02:48
Show Gist options
  • Save rafaelfelini/6928854 to your computer and use it in GitHub Desktop.
Save rafaelfelini/6928854 to your computer and use it in GitHub Desktop.
Elasticsearch parent child query with filter example
curl -XPOST localhost:9200/skus/sku/_search -d '{
"query":{
"filtered":{
"query":{
"match_all":{
}
},
"filter":{
"has_child":{
"type":"application",
"query":{
"term":{
"applications":"1986|TOYOTA|CELICA|GT|2.2 16V"
}
}
}
}
}
}
}'
curl -XPOST localhost:9200/skus/sku/_search -d '{
"fields":[
"id"
],
"query":{
"filtered":{
"query":{
"match_all":{
}
},
"filter":{
"has_child":{
"type":"application",
"query":{
"bool":{
"must":{
"wildcard":{
"applications":"1994|VOLKSWAGEN*"
}
}
}
}
}
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment