Elasticsearch version: 5.1
Plugins installed: Head
JVM version: 1.8
OS version:Ubuntu- 14.04
Steps to reproduce:
http://localhost:9200/A/type/_search POST
{
"query": {
"percolate": {
"field": "query",
"document_type": "b",
"type": "b",
"id": 51411883, // id of the document for which matching queries needed from Index A
"index": "B"
},
// below is the filter i am trying to add but not working Error: [percolate] malformed query, expected // [END_OBJECT] but found [FIELD_NAME]
// is there a different way to use filter with percolate query.
// Also did not find any help from Elastic docs regarding same.
"bool": {
"filter": {
"terms": {
"is_leap_prf": 1
}
}
}
}
}
A post filter can be used
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-post-filter.html
But this only has one filter that can be added.
The percolate query should work like any other query, ie.
http://localhost:9200/A/type/_search POST
{
"query": {
"bool": {
"must": [
{
"percolate": {
"field": "query",
"document_type": "b",
"type": "b",
"id": 51411883,
"index": "B"
}
}
],
"filter": [
{
"terms": {
"is_leap_prf": 1
}
}
]
}
}
}
I'm closing as I assume this would fix your issue. Please reopen if it does not.
Thank you @priyolahiri and @jpountz . This resolved my issue.
Most helpful comment
The
percolatequery should work like any other query, ie.