# Multiple score fields?

**URL:** <https://discuss.elastic.co/t/multiple-score-fields/322323>\
**Category:** Elasticsearch\
**Created:** [January 2, 2023, 2:53pm UTC](https://discuss.elastic.co/t/multiple-score-fields/322323 "2023-01-02T14:53:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![petrskokan11](https://avatars.discourse-cdn.com/v4/letter/p/6bbea6/32.png) [@petrskokan11](https://discuss.elastic.co/u/petrskokan11)\
**Post date:** [January 2, 2023, 2:53pm UTC](https://discuss.elastic.co/t/multiple-score-fields/322323/1 "2023-01-02T14:53:30Z")

</div>

Maybe a dummy question: is it possible to have multiple score fields?

I use a custom score based on function\_score query. This score is being displayed to the user to show, how much each document matches his/her preferences. So far so good.

But! The user should be able to filter the documents and (of course) sort them not only by the custom relevance (how much each document matches his/her preferences) but also by the common relevance - how much each document matches the filter criteria.

So my first idea was to place the score calculated by function\_score query to a custom field but it does not seems to be supported.

Or am I completely wrong and I should use another approach?

---

<div class="post-metadata">

**Author:** ![petrskokan11](https://avatars.discourse-cdn.com/v4/letter/p/6bbea6/32.png) [@petrskokan11](https://discuss.elastic.co/u/petrskokan11)\
**Post date:** [January 5, 2023, 11:03am UTC](https://discuss.elastic.co/t/multiple-score-fields/322323/2 "2023-01-05T11:03:50Z")

</div>

I took a different approach - in case user applies some filter the I run the query without function\_score percolation and use the score calculated by ES and sort by it. Then I take all IDs from the result page and run percolation query with these IDs to get the custom "matching score". It does not seems to cause noticeable slowdown.

Anyway, I welcome any feedback.

---

<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:** [February 2, 2023, 11:03am UTC](https://discuss.elastic.co/t/multiple-score-fields/322323/3 "2023-02-02T11:03:53Z")

</div>

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