# Score highlighted fields

**URL:** <https://discuss.elastic.co/t/score-highlighted-fields/355213>\
**Category:** Elasticsearch\
**Created:** [March 12, 2024, 8:37am UTC](https://discuss.elastic.co/t/score-highlighted-fields/355213 "2024-03-12T08:37:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sudipta\_Bhowmick](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sudipta_bhowmick/32/121815_2.png) [@Sudipta\_Bhowmick](https://discuss.elastic.co/u/Sudipta_Bhowmick)\
**Post date:** [March 12, 2024, 8:37am UTC](https://discuss.elastic.co/t/score-highlighted-fields/355213/1 "2024-03-12T08:37:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 12, 2024, 9:47am UTC](https://discuss.elastic.co/t/score-highlighted-fields/355213/2 "2024-03-12T09:47:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Sudipta\_Bhowmick](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sudipta_bhowmick/32/121815_2.png) [@Sudipta\_Bhowmick](https://discuss.elastic.co/u/Sudipta_Bhowmick)\
**Post date:** [March 12, 2024, 10:12am UTC](https://discuss.elastic.co/t/score-highlighted-fields/355213/3 "2024-03-12T10:12:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 12, 2024, 10:37am UTC](https://discuss.elastic.co/t/score-highlighted-fields/355213/4 "2024-03-12T10:37:11Z")

</div>

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](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html#request-body-sub-searches)

---

<div class="post-metadata">

**Author:** ![Sudipta\_Bhowmick](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sudipta_bhowmick/32/121815_2.png) [@Sudipta\_Bhowmick](https://discuss.elastic.co/u/Sudipta_Bhowmick)\
**Post date:** [March 12, 2024, 11:21am UTC](https://discuss.elastic.co/t/score-highlighted-fields/355213/5 "2024-03-12T11:21:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sudipta\_Bhowmick](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sudipta_bhowmick/32/121815_2.png) [@Sudipta\_Bhowmick](https://discuss.elastic.co/u/Sudipta_Bhowmick)\
**Post date:** [March 12, 2024, 12:15pm UTC](https://discuss.elastic.co/t/score-highlighted-fields/355213/6 "2024-03-12T12:15:50Z")

</div>

Hi **sub\_searches** doesn't meet my requirement. can you suggest anything else ?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 12, 2024, 12:17pm UTC](https://discuss.elastic.co/t/score-highlighted-fields/355213/7 "2024-03-12T12:17:59Z")

</div>

Nope. I'm running out of ideas.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 9, 2024, 12:18pm UTC](https://discuss.elastic.co/t/score-highlighted-fields/355213/8 "2024-04-09T12:18:30Z")

</div>

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