Multiple score fields?

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?

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.

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