Score highlighted fields

Hi, Unable to get solution for the following requirement. Can anyone suggest on this please ?

  • I have a ES query that searches for 4 fields in my index and provides highlighted result. But i want to score the highlighted fields of every single document.
  • Although i'm able to get Score for every document but i want to fetch score of highlighted fields of each document.

I don't think you can really do that unless you use may be ?explain=true so that will give you the detailed score per field.

i tried that but it seems complex, gets lots of unnecessary detail apart from this there is no specific keys so that i can fetch the scores easily. I have tried using named queries. It provided a key named " matched_query " in response but idk whether its sorting the field names on behalf their matching score or not.

Can you suggest anything on this please

The named query will only tell you which query matched. Not which field of the query matched and with which score.

Have a look at sub_searches in case this gives you better results. See Search API | Elasticsearch Guide [8.12] | Elastic

Thank you @dadoonet let me try this. will get back here in case any issue

Hi sub_searches doesn't meet my requirement. can you suggest anything else ?

Nope. I'm running out of ideas.

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