Percolation exact match

I've been following the guide linked below:

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-percolate-query.html

In these examples bonsai or tree will match any documents as illustrated in the "percolating multiple documents" example further down the page. How do you do exact matches where all words in the registered percolator queries have to be present?

The default behavior of the match query (used in the example) is to use the OR operator. You could change that into an AND operator by registering the percolator query like this:

PUT /my-index/_doc/1?refresh
{
  "query": {
    "match": {
      "message": {
        "query": "bonsai tree",
        "operator": "and"
      }
    }
  }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.