What will be the best way to get the relative score of specific bool clauses on the hits?

Hi!

I'm using Elasticsearch 6.2 and have a compound search query that is generated from list of user's items. To explain it short, the goal is to search for items that are similar to those of the specific user. Now I have a new task - I need to determine which of my top level bool clauses influenced the score on each hit the most to pair each hit with an item that bool clause was generated from.

I thought of building my query like this:

"query": {
    "bool": {
      "should": [
        {
          "bool": {
            "must": {
              ... // scoring criterias of item #1
            }
          }
        },
        ...
        {
          "bool": {
            "must": {
              ... // scoring criterias of item #n
            }
          }
        }
      ]
    }
  }

How should I approach this task? I need to know for each hit which "bool" inside "should" array influenced it's score the most. I am new to elasticsearch and kinda lost a little bit. Should I run explain queries for each of the hits?

Any help will be much appreciated. I want to know if Elasticsearch have tools to achieve such a task and get a direction to look at.

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