Description
Hosted ES in elastic cloud (GCP) v7.5.1
I am trying to use script_score to modify a score. I use a bool query but when running this under script_score it results in a null pointer exception. If I remove the bool query and run a simple match query it works.
Steps to reproduce:
Please include a minimal but complete recreation of the problem, including
(e.g.) index creation, mappings, settings, query etc. The easier you make for
us to reproduce it, the more likely that somebody will take the time to look at it.
- Attempt to use script_score with a bool query
Example query below
{ "query": { "script_score": { "query": { "bool": { "filter": [ { "range": { "validFrom": { "from": null, "to": "2020-01-08" } } } ] } }, "script": { "source": "_score + (doc['boostScore'].value)", "lang": "painless" } } } }
This example works
{ "query": { "script_score": { "query": { "match": { "message": "elasticsearch" } }, "script": { "source": "_score + (doc['boostScore'].value)", "lang": "painless" } } } }