I'm using a
script_score query where the score script is this:
double decay = params.decays.getOrDefault(doc['spider'].value, 0.1); def ts = doc['last_update'].size()!=0 ? doc['last_update'].value : doc['timestamp'].value; def boost = params['boosts'].getOrDefault(doc['spider'].value, 1.0); def decay = (decayDateGauss(params.now, "1200d", "90d", decay, ts)*(1-0.2)+0.2) return _score * boost * decay;
Investigating why a document scored higher than another, I tried to limit the query to those two documents, and got very different scores.
To isolate what changed, I
returned all three parts of the score separately, once with all documents, once limiting to those two.
To my great surprise,
boost gave the same value for each document, regardless of the number of documents returned.
decay changed from .96 to .68, for one of the documents (lower when returning only the two results, and this is the correct result I would expect).
In each case (two docs/all the docs), calculating the product of the three components returned this way gives me the original, complete score.
So my question is: why does the output of