-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Remove deprecated options for query_string #29203
Merged
jimczi
merged 2 commits into
elastic:master
from
jimczi:remove_query_string_depr_options
Mar 22, 2018
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,15 +78,9 @@ public class QueryStringQueryBuilder extends AbstractQueryBuilder<QueryStringQue | |
private static final ParseField ANALYZER_FIELD = new ParseField("analyzer"); | ||
private static final ParseField QUOTE_ANALYZER_FIELD = new ParseField("quote_analyzer"); | ||
private static final ParseField ALLOW_LEADING_WILDCARD_FIELD = new ParseField("allow_leading_wildcard"); | ||
private static final ParseField AUTO_GENERATE_PHRASE_QUERIES_FIELD = new ParseField("auto_generate_phrase_queries") | ||
.withAllDeprecated("This setting is ignored, use [type=phrase] instead"); | ||
private static final ParseField MAX_DETERMINIZED_STATES_FIELD = new ParseField("max_determinized_states"); | ||
private static final ParseField LOWERCASE_EXPANDED_TERMS_FIELD = new ParseField("lowercase_expanded_terms") | ||
.withAllDeprecated("Decision is now made by the analyzer"); | ||
private static final ParseField ENABLE_POSITION_INCREMENTS_FIELD = new ParseField("enable_position_increments"); | ||
private static final ParseField ESCAPE_FIELD = new ParseField("escape"); | ||
private static final ParseField USE_DIS_MAX_FIELD = new ParseField("use_dis_max") | ||
.withAllDeprecated("Set [tie_breaker] to 1 instead"); | ||
private static final ParseField FUZZY_PREFIX_LENGTH_FIELD = new ParseField("fuzzy_prefix_length"); | ||
private static final ParseField FUZZY_MAX_EXPANSIONS_FIELD = new ParseField("fuzzy_max_expansions"); | ||
private static final ParseField FUZZY_REWRITE_FIELD = new ParseField("fuzzy_rewrite"); | ||
|
@@ -97,13 +91,7 @@ public class QueryStringQueryBuilder extends AbstractQueryBuilder<QueryStringQue | |
private static final ParseField MINIMUM_SHOULD_MATCH_FIELD = new ParseField("minimum_should_match"); | ||
private static final ParseField QUOTE_FIELD_SUFFIX_FIELD = new ParseField("quote_field_suffix"); | ||
private static final ParseField LENIENT_FIELD = new ParseField("lenient"); | ||
private static final ParseField LOCALE_FIELD = new ParseField("locale") | ||
.withAllDeprecated("Decision is now made by the analyzer"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should add this to the breaking changes doc above? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, thanks |
||
private static final ParseField TIME_ZONE_FIELD = new ParseField("time_zone"); | ||
private static final ParseField SPLIT_ON_WHITESPACE = new ParseField("split_on_whitespace") | ||
.withAllDeprecated("This setting is ignored, the parser always splits on operator"); | ||
private static final ParseField ALL_FIELDS_FIELD = new ParseField("all_fields") | ||
.withAllDeprecated("Set [default_field] to `*` instead"); | ||
private static final ParseField TYPE_FIELD = new ParseField("type"); | ||
private static final ParseField GENERATE_SYNONYMS_PHRASE_QUERY = new ParseField("auto_generate_synonyms_phrase_query"); | ||
private static final ParseField FUZZY_TRANSPOSITIONS_FIELD = new ParseField("fuzzy_transpositions"); | ||
|
@@ -193,13 +181,7 @@ public QueryStringQueryBuilder(StreamInput in) throws IOException { | |
} | ||
allowLeadingWildcard = in.readOptionalBoolean(); | ||
analyzeWildcard = in.readOptionalBoolean(); | ||
if (in.getVersion().before(Version.V_5_1_1)) { | ||
in.readBoolean(); // lowercase_expanded_terms | ||
} | ||
enablePositionIncrements = in.readBoolean(); | ||
if (in.getVersion().before(Version.V_5_1_1)) { | ||
in.readString(); // locale | ||
} | ||
fuzziness = new Fuzziness(in); | ||
fuzzyPrefixLength = in.readVInt(); | ||
fuzzyMaxExpansions = in.readVInt(); | ||
|
@@ -219,13 +201,11 @@ public QueryStringQueryBuilder(StreamInput in) throws IOException { | |
timeZone = in.readOptionalTimeZone(); | ||
escape = in.readBoolean(); | ||
maxDeterminizedStates = in.readVInt(); | ||
if (in.getVersion().onOrAfter(Version.V_5_1_1)) { | ||
if (in.getVersion().before(Version.V_6_0_0_beta1)) { | ||
in.readBoolean(); // split_on_whitespace | ||
Boolean useAllField = in.readOptionalBoolean(); | ||
if (useAllField != null && useAllField) { | ||
defaultField = "*"; | ||
} | ||
if (in.getVersion().onOrAfter(Version.V_5_1_1) && in.getVersion().before(Version.V_6_0_0_beta1)) { | ||
in.readBoolean(); // split_on_whitespace | ||
Boolean useAllField = in.readOptionalBoolean(); | ||
if (useAllField != null && useAllField) { | ||
defaultField = "*"; | ||
} | ||
} | ||
if (in.getVersion().onOrAfter(Version.V_6_1_0)) { | ||
|
@@ -252,13 +232,7 @@ protected void doWriteTo(StreamOutput out) throws IOException { | |
} | ||
out.writeOptionalBoolean(this.allowLeadingWildcard); | ||
out.writeOptionalBoolean(this.analyzeWildcard); | ||
if (out.getVersion().before(Version.V_5_1_1)) { | ||
out.writeBoolean(true); // lowercase_expanded_terms | ||
} | ||
out.writeBoolean(this.enablePositionIncrements); | ||
if (out.getVersion().before(Version.V_5_1_1)) { | ||
out.writeString(Locale.ROOT.toLanguageTag()); // locale | ||
} | ||
this.fuzziness.writeTo(out); | ||
out.writeVInt(this.fuzzyPrefixLength); | ||
out.writeVInt(this.fuzzyMaxExpansions); | ||
|
@@ -277,12 +251,10 @@ protected void doWriteTo(StreamOutput out) throws IOException { | |
out.writeOptionalTimeZone(timeZone); | ||
out.writeBoolean(this.escape); | ||
out.writeVInt(this.maxDeterminizedStates); | ||
if (out.getVersion().onOrAfter(Version.V_5_1_1)) { | ||
if (out.getVersion().before(Version.V_6_0_0_beta1)) { | ||
out.writeBoolean(false); // split_on_whitespace | ||
Boolean useAllFields = defaultField == null ? null : Regex.isMatchAllPattern(defaultField); | ||
out.writeOptionalBoolean(useAllFields); | ||
} | ||
if (out.getVersion().onOrAfter(Version.V_5_1_1) && out.getVersion().before(Version.V_6_0_0_beta1)) { | ||
out.writeBoolean(false); // split_on_whitespace | ||
Boolean useAllFields = defaultField == null ? null : Regex.isMatchAllPattern(defaultField); | ||
out.writeOptionalBoolean(useAllFields); | ||
} | ||
if (out.getVersion().onOrAfter(Version.V_6_1_0)) { | ||
out.writeBoolean(autoGenerateSynonymsPhraseQuery); | ||
|
@@ -824,8 +796,6 @@ public static QueryStringQueryBuilder fromXContent(XContentParser parser) throws | |
quoteFieldSuffix = parser.textOrNull(); | ||
} else if (LENIENT_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { | ||
lenient = parser.booleanValue(); | ||
} else if (ALL_FIELDS_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { | ||
defaultField = "*"; | ||
} else if (MAX_DETERMINIZED_STATES_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { | ||
maxDeterminizedStates = parser.intValue(); | ||
} else if (TIME_ZONE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { | ||
|
@@ -841,16 +811,6 @@ public static QueryStringQueryBuilder fromXContent(XContentParser parser) throws | |
autoGenerateSynonymsPhraseQuery = parser.booleanValue(); | ||
} else if (FUZZY_TRANSPOSITIONS_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { | ||
fuzzyTranspositions = parser.booleanValue(); | ||
} else if (AUTO_GENERATE_PHRASE_QUERIES_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { | ||
// ignore, deprecated setting | ||
} else if (LOWERCASE_EXPANDED_TERMS_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { | ||
// ignore, deprecated setting | ||
} else if (LOCALE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { | ||
// ignore, deprecated setting | ||
} else if (USE_DIS_MAX_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { | ||
// ignore, deprecated setting | ||
} else if (SPLIT_ON_WHITESPACE.match(currentFieldName, parser.getDeprecationHandler())) { | ||
// ignore, deprecated setting | ||
} else { | ||
throw new ParsingException(parser.getTokenLocation(), "[" + QueryStringQueryBuilder.NAME + | ||
"] query does not support [" + currentFieldName + "]"); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 we should add this to the breaking changes doc above?
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.
Thanks