Skip to content

Deprecate local parameter for get field mapping request #55014

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

Merged
merged 9 commits into from
Apr 12, 2020

Conversation

ywangd
Copy link
Member

@ywangd ywangd commented Apr 9, 2020

The usage of local parameter for GetFieldMappingRequest has been removed from the underlying transport action since v2.0.

This PR deprecate the parameter from rest layer. It will be removed in next major version.

@ywangd ywangd added :Data Management/Indices APIs APIs to create and manage indices and templates >deprecation v8.0.0 v7.8.0 labels Apr 9, 2020
@ywangd ywangd requested a review from martijnvg April 9, 2020 14:42
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (:Core/Features/Indices APIs)

@ywangd ywangd added the WIP label Apr 9, 2020
Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

Looks good. Left a comment and also the org.elasticsearch.client.indices.GetFieldMappingsRequest class in HLRC module should be modified. I suggest keeping the local(...) methods with a @Deprecated annotation, but not serializing/sending the local parameter.

if (request.hasParam("local")) {
deprecationLogger.deprecatedAndMaybeLog("get_field_mapping_local",
"Use [local] in get field mapping requests is deprecated."
+ "The parameter will be removed in the next major version");
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a space between the two sentences?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, added.

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

Left two minor comments, otherwise LGTM.

deprecated:[7.8.0, Field mappings are always retrieved locally]
(Optional, boolean) If `true`, the request retrieves information from the local
node only. Defaults to `false`, which means information is retrieved from
the master node.
Copy link
Member

Choose a reason for hiding this comment

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

I would add that the parameter currently is just a noop.

Can you also update the migrate_7_8.asciidoc file when backporting this change to the 7.x branch?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added. Thanks for the heads up about the migrate doc. Will do for 7.x.

@@ -705,11 +707,12 @@ public void testGetFieldMapping() throws IOException, InterruptedException {
request.local(true); // <1>
// end::get-field-mappings-request-local

{
final RequestOptions requestOptions = RequestOptions.DEFAULT.toBuilder().setWarningsHandler(WarningsHandler.PERMISSIVE).build();
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Followed your suggestion to add deprecated annotation to GetFieldMappingsRequest#local(..) methods and removed it from the conversion. It works better and this change to RequestOptions is no longer necessary.

node_selector:
version: "7.8.0 - "
warnings:
- "Use [local] in get field mapping requests is deprecated.The parameter will be removed in the next major version"
Copy link
Member

Choose a reason for hiding this comment

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

I think a space would need to be added here, otherwise this test will fail.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. It indeed failed for many of the CI tests ...

@ywangd ywangd removed the WIP label Apr 12, 2020
@ywangd ywangd merged commit 6ce8803 into elastic:master Apr 12, 2020
ywangd added a commit to ywangd/elasticsearch that referenced this pull request Apr 12, 2020
The usage of local parameter for GetFieldMappingRequest has been removed from the underlying transport action since v2.0.

This PR deprecates the parameter from rest layer. It will be removed in next major version.
ywangd added a commit that referenced this pull request Apr 12, 2020
)

The usage of local parameter for GetFieldMappingRequest has been removed from the underlying transport action since v2.0.

This PR deprecates the parameter from rest layer. It will be removed in next major version.
@ywangd
Copy link
Member Author

ywangd commented Apr 12, 2020

Backported:

  • 7.8.0

russcam added a commit to russcam/elasticsearch that referenced this pull request May 28, 2020
Relates: elastic#55014

This commit deprecates the local param in get_mapping.json.
This parameter is a no-op and field mappings are always retrieved locally.
russcam added a commit that referenced this pull request May 29, 2020
Relates: #55014

This commit deprecates the local param in get_mapping.json.
This parameter is a no-op and field mappings are always retrieved locally.
russcam added a commit that referenced this pull request May 29, 2020
Relates: #55014

This commit deprecates the local param in get_mapping.json.
This parameter is a no-op and field mappings are always retrieved locally.

(cherry picked from commit 0b041cc)
nielsbauman added a commit to nielsbauman/elasticsearch that referenced this pull request Feb 19, 2025
The `local` param for the `GetFieldMapping` API was deprecated in elastic#55014
and I think elastic#57265 aimed to propogate that deprecation to the REST API
spec, but it changed `get_mapping.json` instead of
`get_field_mapping.json`. elastic#55100 removed the `local` param for the
_field_ mapping API so we can safely remove the field from the spec and
remove the YAML test.
nielsbauman added a commit that referenced this pull request Feb 19, 2025
The `local` param for the `GetFieldMapping` API was deprecated in #55014
and I think #57265 aimed to propogate that deprecation to the REST API
spec, but it changed `get_mapping.json` instead of
`get_field_mapping.json`. #55100 removed the `local` param for the
_field_ mapping API so we can safely remove the field from the spec and
remove the YAML test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants