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

multi_match lenient query with boosted field crashes with NullPointerException #3797

Closed
IlyaSemenov opened this issue Sep 27, 2013 · 1 comment

Comments

@IlyaSemenov
Copy link

A lenient multi_match query with a boosted field with type mismatch crashes. Simple example:

curl -XPUT http://localhost:9200/blog/post/1?pretty=1 -d '{"foo":123, "bar":"xyzzy"}'
curl -XGET http://localhost:9200/blog/post/_count?pretty=1 -d '{"multi_match": {"fields": ["foo^2", "bar"], "lenient": true, "query": "xyzzy"}}' # crashes with NullPointerException

Interestingly, it works for internal _id field:

curl -XGET http://localhost:9200/blog/post/_count?pretty=1 -d '{"multi_match": {"fields": ["_id^2", "bar"], "lenient": true, "query": "xyzzy"}}' # works

And it doesn't crash when there's no type mismatch:

curl -XGET http://localhost:9200/blog/post/_count?pretty=1 -d '{"multi_match": {"fields": ["foo^2", "bar"], "lenient": true, "query": "123"}}' # works

Other queries for reference:

curl -XGET http://localhost:9200/blog/post/_count?pretty=1 -d '{"multi_match": {"fields": ["foo", "bar"], "lenient": true, "query": "xyzzy"}}' # works
curl -XGET http://localhost:9200/blog/post/_count?pretty=1 -d '{"multi_match": {"fields": ["foo", "bar"], "query": "xyzzy"}}' # crashes with NumberFormatException - expected

@eltu
Copy link
Contributor

eltu commented Sep 27, 2013

More information about error:

Happen the error in class LongFieldMapper.java in the method parsevalue(). The cause of error is a NumberFormatExpcetion, becuase the value(xyzzy) arrive in the method is String.

java.lang.NumberFormatException: For input string: "xyzzy"

eltu added a commit to eltu/elasticsearch that referenced this issue Sep 30, 2013
@ghost ghost assigned javanna Oct 18, 2013
eltu added a commit to eltu/elasticsearch that referenced this issue Oct 24, 2013
I changed the class MultiMatchQuery for support the issue elastic#3797
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants