Closed cbuescher closed 7 years ago
Related to #21489 (another scientific notation issue)
@dakrone yes, but only partially related. Scientific notation is okay as long as we don't analyze it here.
The "match" query seems to have the similar problem.
Should we always throw an error when specifying an analyzer together with a numeric field in the query builder already?
Multi-match can have multiple fields, so perhaps we only use the analyzer for text and keyword fields. (I'm in two minds about keyword fields, but I could imagine lower casing the search term).
For match, where only one field can be specified, we should probably throw an exception on fields that are neither text nor keyword.
here is the REPRODUCE line: REPRODUCE WITH: gradle :core:test -Dtests.seed=8BA49CFAC7249C2F -Dtests.class=org.elasticsearch.index.query.MultiMatchQueryBuilderTests -Dtests.method="testToQuery" -Dtests.security.manager=true -Dtests.locale=lv-LV -Dtests.timezone=Asia/Kathmandu
Closing this after discussion with @jpountz in https://github.com/elastic/elasticsearch/pull/23684. We agreed that the error we currently throw in this edge case is okay and we should change the test to avoid running into this in our randomization.
This strange combination of three parameters just came in via CI: https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+5.x+multijob-unix-compatibility/os=debian/252/console
The query that trips this looks like this (simplified):
So although this is a double field, the value gets analyzed in lucenes QueryBuilder#analyzeTerm which leaves only the String "e" which in turn cannot be parsed to a double. This later leads to a NumberFormatException:
I wonder where we should catch this. Should we always throw an error when specifying an analyzer together with a numeric field in the query builder already? I think that would make sense.