Skip to content
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 several parse field deprecations in query builders #26711

Merged
merged 6 commits into from
Sep 20, 2017

Conversation

cbuescher
Copy link
Member

@cbuescher cbuescher commented Sep 19, 2017

This change removes parse fields that are either completely deprecated since version 5.0 or removes deprecated names.
This PR is opened against master, but should be backported to the 6.x and 6.0 branches with additional notes
to the migration docs in 6.0.

@@ -123,9 +110,13 @@ public MatchQueryBuilder(StreamInput in) throws IOException {
super(in);
fieldName = in.readString();
value = in.readGenericValue();
type = MatchQuery.Type.readFromStream(in);
if (in.getVersion().onOrAfter(Version.V_6_0_0_rc1)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assumes these changes should and can be backported to 6.0.0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic seems wrong. I think it should be before and not onOrAfter ?
Also you should do that in multiple steps to avoid build failures. Start with current version (v7), then backport to v6 and when the build is green you can change the expected version here to be v6. You can add a TODO comment to make sure that reviewers understand the expectations.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, of course it should be before, bad copy error on my side. Looking at this, I think I will pull out the MatchQueryBuilder changes to a separate PR since I think it will make backporting easier, the rest of this PR is more straight forward.

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this @cbuescher !
I left some comments.

@@ -123,9 +110,13 @@ public MatchQueryBuilder(StreamInput in) throws IOException {
super(in);
fieldName = in.readString();
value = in.readGenericValue();
type = MatchQuery.Type.readFromStream(in);
if (in.getVersion().onOrAfter(Version.V_6_0_0_rc1)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic seems wrong. I think it should be before and not onOrAfter ?
Also you should do that in multiple steps to avoid build failures. Start with current version (v7), then backport to v6 and when the build is green you can change the expected version here to be v6. You can add a TODO comment to make sure that reviewers understand the expectations.

operator = Operator.readFromStream(in);
slop = in.readVInt();
if (in.getVersion().onOrAfter(Version.V_6_0_0_rc1)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@@ -146,9 +137,13 @@ public MatchQueryBuilder(StreamInput in) throws IOException {
protected void doWriteTo(StreamOutput out) throws IOException {
out.writeString(fieldName);
out.writeGenericValue(value);
type.writeTo(out);
if (out.getVersion().onOrAfter(Version.V_6_0_0_rc1)) {
MatchQuery.Type.BOOLEAN.writeTo(out);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

operator.writeTo(out);
out.writeVInt(slop);
if (out.getVersion().onOrAfter(Version.V_6_0_0_rc1)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

;)

The `fielddata` field and the use of the `_name` field in the short syntax of
the range query have been deprecated in 5.0 and can be removed.
All of these have already been deprecated in 5.0 and can thus be removed in 6.0.
@cbuescher cbuescher force-pushed the remove-QueryBuilder-deprecations branch from 9ea87f4 to b9273d8 Compare September 20, 2017 10:30
@cbuescher
Copy link
Member Author

@jimczi thanks for the review, I pulled out the changes in the MatchQueryBuilder and related test into #26720 to make this PR a little smaller and easier to backport. Is there anything to the remaining part you would like to be changed? I was planning to add the notes to the migration docs only when backporting to the 6.0 branch.

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cbuescher cbuescher merged commit 86b00b8 into elastic:master Sep 20, 2017
cbuescher added a commit that referenced this pull request Sep 20, 2017
The `fielddata` field and the use of the `_name` field in the short syntax of the range
query have been deprecated in 5.0 and can be removed.

The same goes for the deprecated `score_mode` field in HasParentQueryBuilder,
the deprecated `like_text`, `ids` and `docs` parameter in the `more_like_this` query,
the deprecated query name in the short version of the `regexp` query, and several
deprecated alternative field names in other query builders.
cbuescher added a commit that referenced this pull request Sep 20, 2017
The `fielddata` field and the use of the `_name` field in the short syntax of the range
query have been deprecated in 5.0 and can be removed.

The same goes for the deprecated `score_mode` field in HasParentQueryBuilder,
the deprecated `like_text`, `ids` and `docs` parameter in the `more_like_this` query,
the deprecated query name in the short version of the `regexp` query, and several
deprecated alternative field names in other query builders.
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Sep 20, 2017
* master:
  [DOCS] Added index-shared4 and index-shared5.asciidoc
  BulkProcessor flush runnable preserves the thread context from creation time (elastic#26718)
  Catch exceptions and inform handler in RemoteClusterConnection#collectNodes (elastic#26725)
  [Docs] Fix name of character filter in example. (elastic#26724)
  Remove parse field deprecations in query builders (elastic#26711)
  elastic#26720: Set the correct bwc version after backport to 6.0
  Remove deprecated type and slop field in MatchQueryBuilder (elastic#26720)
  Refactoring of Gateway*** classes (elastic#26706)
  Make RestHighLevelClient's Request class public (elastic#26627)
  Deguice ActionFilter (elastic#26691)
  aggs: Allow aggregation sorting via nested aggregation.
  Build: Set bwc builds to always set snapshot (elastic#26704)
  File Discovery: Remove fallback with zen discovery (elastic#26667)
@lcawl lcawl removed the v6.1.0 label Dec 12, 2017
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Query DSL labels Feb 14, 2018
@colings86 colings86 removed the v7.0.0 label Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking :Search/Search Search-related issues that do not fall into other categories v6.0.0-rc1 v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants