Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException when bool query used in script score #50738

Closed
davidb-e4s opened this issue Jan 8, 2020 · 3 comments
Closed

NullPointerException when bool query used in script score #50738

davidb-e4s opened this issue Jan 8, 2020 · 3 comments

Comments

@davidb-e4s
Copy link

davidb-e4s commented Jan 8, 2020

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.

  1. 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" } } } }

@jimczi
Copy link
Contributor

jimczi commented Jan 8, 2020

Thanks for reporting @davidb-e4s , this bug is already fixed by #48425 so I hope you don't mind if I close this. The next minor release (7.6.0) will contain the fix.

@jimczi jimczi closed this as completed Jan 8, 2020
@davidb-e4s
Copy link
Author

OK thanks @jimczi do you have an ETA on the release?

@jimczi
Copy link
Contributor

jimczi commented Jan 8, 2020

As a matter of policy, we don't give ETAs, even approximate, sorry. However you can apply the workaround described here in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants