Using rank_feature to achieve lower boosting the higher the value is

I have an index with a rank_feature field that's either empty, or a positive integer. In my case, 1 represents the most relevant document within the rank's context, while higher numbers represent lower relevance. I'd like to also represent this in a query, but I have so far failed to produce a rank_feature query that boosts 1 the most, and everything after progressively less.

I haven't found any valid ways to do this using purely rank_feature. Using field_value_factor with the reciprocal modifier looked like the way to go, but I can't use a rank_feature inside of function_score. I also tried using function_score with a painless script, but that went nowhere too. I can't access it from there either.

Am I overthinking this? Any help would be appreciated.

  "function_score": {
    "field_value_factor": {
      "field": "myField",
      "factor": 1.2,
      "modifier": "reciprocal"

Leads to [rank_feature] fields do not support sorting, scripting or aggregating.

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