# Using rank\_feature to achieve lower boosting the higher the value is

**URL:** <https://discuss.elastic.co/t/using-rank-feature-to-achieve-lower-boosting-the-higher-the-value-is/327860>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [March 16, 2023, 2:16pm UTC](https://discuss.elastic.co/t/using-rank-feature-to-achieve-lower-boosting-the-higher-the-value-is/327860 "2023-03-16T14:16:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mustachipleb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mustachipleb/32/118530_2.png) [@Mustachipleb](https://discuss.elastic.co/u/Mustachipleb)\
**Post date:** [March 16, 2023, 2:16pm UTC](https://discuss.elastic.co/t/using-rank-feature-to-achieve-lower-boosting-the-higher-the-value-is/327860/1 "2023-03-16T14:16:44Z")

</div>

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.

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

```

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 13, 2023, 2:16pm UTC](https://discuss.elastic.co/t/using-rank-feature-to-achieve-lower-boosting-the-higher-the-value-is/327860/2 "2023-04-13T14:16:55Z")

</div>

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