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
Function score query fails with field_value_factor on not (yet) existing field #10948
Comments
The "working" example you have isn't really the same; it is doing a filter, not a function score, in which case the field not existing in the mappings means "match no docs". But for
|
In this particular case, we could probably handle this by adding a |
#10845 has already added a Perhaps the way to go here is to extend support for missing mappings with the suggestion here: #9521 (comment) |
After discussing this in fix it friday, we think that the new |
I will take a shot at this one. |
Hi,
My ES function score query contains several different functions based on a set of different fields. I'm having problems with field_value_factor on not existing fields.
I'm not sure if that's expected behavior or a bug in ES.
On the elasticsearch Google group, nobody had an idea, so any help is appreciated.
A minimal example on how to reproduce the problem:
Example document:
A search request, that boosts based on the function score looks like that:
Everything is fine until this point.
When I change the "field" param to "likes", the requests fails:
->
ElasticsearchException[Unable to find a field mapper for field [likes]
"likes" doesn't exist yet in the "page" document type, but it might exist in the future. Or there could be another type "page2", where the "likes" field exists, and I need to query both "page" and "page2" in 1 request.
What I tried, is to put an exist filter beforehand, however, the error remains the same.
->
ElasticsearchException[Unable to find a field mapper for field [likes]
Is this a bug or expected bahavior?
I would expect ES to just skip the function, in case the "exists" filter evaluates to False or the field doesn't exist.
The error originates from
FieldValueFactorFunctionParser.java
(line 89), inFieldValueFactorFunctionParser.parse
.Is there really a need to check for the existence of all fields during parsing?
With other function types, there is no problem, so apparently this parsing is not performed. E.g. the following works without an error:
Any ideas?
Please let me know, if you need further information.
Best regards,
Tobias
The text was updated successfully, but these errors were encountered: