How to find out how a query is matched?

Say I have a field "Message" and some indexed values "quick brown fox", "foxy brownie" in documents. Is there an API in Elasticsearch that I can use to ask question like How have we matched "brown fox" in "Message" of all the documents? and the result returns are

  1. document 1 "Message" : "quick brown fox", matched: ["match", "match_phrase", "phonetic"]
  2. document 2 "Message" : "foxy brownie", matched: ["phonetic", "token_count", "fuzzy", "edge_ngram"]

i.e. Given a querying value, I want to know all the matched types within all configured analysers/filters/query types in the mapping.

I think the dumbest way to achieve the same is to ask separate queries per each configured type, like Does "brown fox" match any document phonetically? Does "brown fox" match any document with the same number of tokens? Is there a handy API that does all this in a single query manner?

Have a look at: https://www.elastic.co/guide/en/elasticsearch/reference/6.5/search-request-named-queries-and-filters.html

I see. You are saying I can give names to my queries and issue my queries possibly in one big query. I see that is no better than the dumb way, just a matter of asking it separately or in batch. Thanks anyway.

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