Is there any limit on the value returned from function_score query in ElasticSearch?

29 Views Asked by At

This is simplified example query

GET my-index/_search
{
  "query": {
    "function_score": {
      "query": {
            "match_all": {}
          },
          "script_score": {
            "script": "return 16777217"
          }
    }
  },
  "sort": [
    {
      "_score": {
        "order": "desc"
      }
    },
    {
      "id": {
        "order": "asc"
      }
    }
  ]
}

and what I get for the sort value in the result hits is

{
        "_shard": "[my-index-00301][0]",
        "_node": "GVZQHq_NQvKlaICNo6HtCA",
        "_index": "my-index-00301",
        "_id": "1",
        "_score": 123123120,
        "_routing": "12",
        "_source": {
          "id": "1"
        },
        "sort": [
          16777216,
          "1"
        ]
}

Is there any reason why the value 16777217 is returned as 16777216 ?

It seems like there is some limit of 2^24 for the function_script return value, but I didn't find any limitation on the function_script value in the ElasticSearch documentation.

0

There are 0 best solutions below