When running an sltr query with the following configuration:
{ "window_size": 20, "query": { "query_weight": 0, "rescore_query_weight": 1, "score_mode": "total", "rescore_query": { "sltr": { "model": "enwiki_32153k_500t", "params": { "query_string": "jfk" } } } } }
Two problems:
- Only the top 20 values get new scores (as expected). It seems although we only ask for 20 documents elasticsearch still sorts more than 20 to return the final result. Because the ML model can return negative values, the documents with a score of 0 come before the negative values when they should stay on the front page. This can probably be fixed by adding a large constant value to all the scores.
- All documents after the initial rescore window have a score of 0. This is a problem for pagination, because the documents after the rescore window can come in any order. This is a little harder to fix. Perhaps the combination of adding a large constant value above, and adjusting the weights to something like query_weight: 1, rescore_query_weight: 100 could do the trick, but it's no guarantee.