-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Allow overriding all-field leniency when lenient
option is specified
#21504
Conversation
I'm not happy that the the lenient property can now be null and that the default needs to be handled in multiple places. Maybe instead the builders could keep track of whether the |
I agree that I don't like having it set to |
@jpountz I pushed another commit that changes the |
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 left a comment about the bw logic. Otherwise LGTM.
@@ -162,6 +164,9 @@ public SimpleQueryStringBuilder(StreamInput in) throws IOException { | |||
in.readBoolean(); // lowercase_expanded_terms | |||
} | |||
settings.lenient(in.readBoolean()); | |||
if (in.getVersion().after(V_5_1_0_UNRELEASED)) { |
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.
s/after/onOrAfter/ ?
@@ -188,6 +193,9 @@ protected void doWriteTo(StreamOutput out) throws IOException { | |||
out.writeBoolean(true); // lowercase_expanded_terms | |||
} | |||
out.writeBoolean(settings.lenient()); | |||
if (out.getVersion().after(V_5_1_0_UNRELEASED)) { |
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.
same here?
67407e1
to
864f6d3
Compare
As part of elastic#20925 and elastic#21341 we added an "all-fields" mode to the `query_string` and `simple_query_string`. This would expand the query to all fields and automatically set `lenient` to true. However, we should still allow a user to override the `lenient` flag to whichever value they desire, should they add it in the request. This commit does that.
864f6d3
to
11da09e
Compare
Thanks @jpountz! |
Looks like elastic#21504 introduced a serialization conditional for lenientSet, but the PR was never backported to 5.x hence whenever simple query string is serialized between 6.x and 5.6, it can't be read/written properly causing errors on the transport layer. This commit updates the conditional to only read/write the field against 6.0+ versions which are aware of it. Closes elastic#38889
Looks like #21504 introduced a serialization conditional for lenientSet, but the PR was never backported to 5.x hence whenever simple query string is serialized between 6.x and 5.6, it can't be read/written properly causing errors on the transport layer. This commit updates the conditional to only read/write the field against 6.0+ versions which are aware of it. Closes #38889
Looks like #21504 introduced a serialization conditional for lenientSet, but the PR was never backported to 5.x hence whenever simple query string is serialized between 6.x and 5.6, it can't be read/written properly causing errors on the transport layer. This commit updates the conditional to only read/write the field against 6.0+ versions which are aware of it. Closes #38889
As part of #20925 and #21341 we added an "all-fields" mode to the
query_string
andsimple_query_string
. This would expand the query toall fields and automatically set
lenient
to true.However, we should still allow a user to override the
lenient
flag towhichever value they desire, should they add it in the request. This
commit does that.