Boost score if field exists with function score

I want to boost score if some_field_4 is exists

but it return error.
How can I do this in elasticsearch 7 ?

reason":"no [query] registered for [function_score]"
{
  "query": {
    "function_score": {
      "query": {
        "bool": {
          "filter": [
            { "terms":{ "some_field_1": [ "y" ] } },
            { "terms":{ "some_field_2": [ "y" ] } }
          ]
        }
      },
      "functions": [
        {
          "filter": { "range": { "some_field_3": { "gte": 5 }}},
          "weight": 23
        },
        {
          "query": { "exists": { "field": "some_field_4" } },
          "weight": 50
        }
      ]
    }
  },
  "from": 0,
  "size": 10
  
}

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