Created
October 11, 2013 02:48
-
-
Save rafaelfelini/6928854 to your computer and use it in GitHub Desktop.
Elasticsearch parent child query with filter example
This file contains hidden or 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 -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