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
Do not track named queries that are null #12691
Conversation
.endObject() | ||
.endObject() | ||
.endObject(); | ||
client().admin().indices().prepareCreate(index).addMapping(type, mapping).execute().actionGet(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can shorten the mapping here: addMapping(type, "name", "type=string, analyzer=stop"
that hurts my eyes less :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorporated, thanks!
left a couple of minor comments, fix looks good though! |
LGTM |
Adding a named query that is null can lead to a NullPointerException when copying the named queries. This is due to an implementation detail in QueryParseContent.copyNamedQueries. In particular, this method uses com.google.common.collect.ImmutableMap.copyOf. A documented requirement of ImmutableMap is that none of the entries have a null key nor null value. Therefore, we should not add such queries to the namedQueries map. This will not change any behavior since Map.get returns null if no entry with the given key exists anyway. Closes #12683
@javanna Thanks for reviewing. |
Do not track named queries that are null
Adding a named query that is null can lead to a
NullPointerException
when copying the named queries. This is due to an implementation detail
in
QueryParseContent.copyNamedQueries
. In particular, this method usescom.google.common.collect.ImmutableMap.copyOf
. A documented requirementof
ImmutableMap
is that none of the entries have a null key nor nullvalue. Therefore, we should not add such queries to the
namedQueries
map. This will not change any behavior since
Map.get
returns null if noentry with the given key exists anyway.
Closes #12683