I am using a typical multi match query on three fields: name, city, state. The multi match query is also using a Java function score script. Is there any way to know in the score script what fields matched my multi match query? If not, is there any way to figure this out from the SearchResponse object?
I am currently on Elasticsearch 1.2.1 but I can easily upgrade if it's necessary.
There is another exact way to find out which field is matched in the query
Because the highlight is post highlight process, it is not accurate because of the way it did
Just use named query to do it instead of multi-match
such as
translate it into bool query with name
it will return the result like that
I don't believe you can do this directly with just multi match, but if you add highlighting you should get a response showing which fields matched:
http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/highlighting-intro.html
In the example from this page:
you would change the match_phrase to a multi_match and add the field list:
and that should get you a highlight response which includes the highlight around the matching text and the field that was matched.