How to retrieve the number of matched terms?

Hey everyone, is there a way to count the number of matching words in the results. I.e. if I have the following query, I'd like to know for the results set, how many of the words: african, american and male were matched (1, 2 or all 3).

I would like to sort the results first by number of matched words, then by account type and then after that by the relevance score. Is something like this possible? I know that Elasticsearch allows for a minimum_should_match parameter that checks against the number of matched terms, so this must be calculated somewhere. I'm just wondering if its possible to access this value?

Thank you!

GET /talent_portfolios/_search
{
  "query": {
      "match": {
        "title": "african american male"
      }
  }
}

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