Reputation: 2125
I have an elasticsearch index with documents, which have nested documents with an "importance" field.
I try to query for the nested documents and get a score for the parent document, which is the sum of the "importance" field of the nested documents (I do this with a "function_score" query)
The problem now is: I have a dynamic count of terms I search with. So the query normalisation has a different factor everytime. And this makes it hard to debug my query.
Example
device_1
component_1 (importance: 1)
component_2 (importance: 0.5)
component_3 (importance: 0.2)
component_4 (importance: 1.5)
device_2
component_1 (importance: 0.3)
component_3 (importance: 2)
component_4 (importance: 1)
The device is the document, the components are nested documents.
Now, when I search for "component_3" and "component_2" I want to have the following result:
device_1, score: 0.7 (0.2 + 0.5)
device_2, score: 2 (2)
But the query normalisation factor is different when I search for one component, or two or three. So I always get different scores, and it is hard to debug and find out if the query does what it should.
Is it possible, to disable the query normalisation? Are there other ideas to deal with fixed scores? I don`t need my queries to be comparable, I need them to be comprehensible.
Upvotes: 2
Views: 1622
Reputation: 123
You can try to use "replace" as "boost_mode" https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html
Upvotes: 1