Skip to content

Commit

Permalink
Add doc on rank_feature(s) negative score impact (#71795)
Browse files Browse the repository at this point in the history
Add a warning about consequences of negative score impact
for documents that don't have values for rank_feature(s)
fields.

Related to #69994
  • Loading branch information
mayya-sharipova committed Apr 20, 2021
1 parent eb6afe4 commit 86b6d22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion docs/reference/mapping/types/rank-features.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,3 @@ Rank features that correlate negatively with the score should set
the <<query-dsl-rank-feature-query,`rank_feature`>> query to modify the scoring formula
in such a way that the score decreases with the value of the feature instead of
increasing.

9 changes: 9 additions & 0 deletions docs/reference/query-dsl/rank-feature-query.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ The `rank_feature` query is typically used in the `should` clause of a
<<query-dsl-bool-query,`bool`>> query so its relevance scores are added to other
scores from the `bool` query.

With `positive_score_impact` set to `false` for a `rank_feature` or
`rank_features` field, we recommend that every document that participates
in a query has a value for this field. Otherwise, if a `rank_feature` query
is used in the should clause, it doesn't add anything to a score of
a document with a missing value, but adds some boost for a document
containing a feature. This is contrary to what we want – as we consider these
features negative, we want to rank documents containing them lower than documents
missing them.

Unlike the <<query-dsl-function-score-query,`function_score`>> query or other
ways to change <<relevance-scores,relevance scores>>, the
`rank_feature` query efficiently skips non-competitive hits when the
Expand Down

0 comments on commit 86b6d22

Please sign in to comment.