Skip to content

Instantly share code, notes, and snippets.

@webpatser
Created September 11, 2012 22:39
Show Gist options
  • Save webpatser/3702686 to your computer and use it in GitHub Desktop.
Save webpatser/3702686 to your computer and use it in GitHub Desktop.
how to percolate elastic search with a query string
working percolator with only fiters:
{
"_index": "_percolator",
"_type": "document",
"_id": "0e63ed80-fc58-11e1-9857-f17a6fbf875a",
"_version": 1,
"exists": true,
"_source": {"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"and": [
{"missing": {"field": "redirect"}},
{"term": {"field": "value"}}
]}
}}}
}
Where to add the querystring to match a string in _all.
{
"_index": "_percolator",
"_type": "document",
"_id": "4984ebe0-fc65-11e1-a1c7-8bc204bcd862",
"_version": 1,
"exists": true,
"_source": {"query":
{"filtered": {
"query": {
"query_string": {"query": "some query"}
},
"filter": {
"and": [
{"missing": {"field": "redirect"}},
{"term": {"field": "value"}}
]}
}
}
}
}
The percolator is accepted by ES, but it never appears as a percolate match :-(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment