How can I aggregate over the _score How can I aggregate over the _score elasticsearch elasticsearch

How can I aggregate over the _score


  "aggs": {    "scores_histogram": {      "histogram": {        "script": "return _score.doubleValue() * 10",        "interval": 3      }    }  }

or, with ranges:

  "aggs": {    "score_ranges": {      "range": {        "script": "_score",        "ranges": [          {            "to": 50          },          {            "from": 50,            "to": 75          },          {            "from": 75          }        ]      }    }  }

And you need to enable dynamic scripting.