-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
ywangd
merged 9 commits into
elastic:master
from
ywangd:deprecate-get-field-mapping-local
Apr 12, 2020
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fb36a51
Add deprecation message for local parameter
ywangd 1a8bd10
Add test for deprecation message
ywangd f6b598e
Remove extra blank line
ywangd f560f34
Fix test failures
ywangd d9f6906
Address feedback
ywangd cd8b08f
Fix tests and address feedback
ywangd acb2140
Fix test failure
ywangd bf911a6
Test deprecation message only for v8.0.0 before backport
ywangd 64d718d
Merge remote-tracking branch 'origin/master' into deprecate-get-field…
ywangd 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -19,12 +19,15 @@ | |
|
||
package org.elasticsearch.rest.action.admin.indices; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRequest; | ||
import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse; | ||
import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetadata; | ||
import org.elasticsearch.action.support.IndicesOptions; | ||
import org.elasticsearch.client.node.NodeClient; | ||
import org.elasticsearch.common.Strings; | ||
import org.elasticsearch.common.logging.DeprecationLogger; | ||
import org.elasticsearch.common.xcontent.XContentBuilder; | ||
import org.elasticsearch.rest.BaseRestHandler; | ||
import org.elasticsearch.rest.BytesRestResponse; | ||
|
@@ -43,6 +46,10 @@ | |
|
||
public class RestGetFieldMappingAction extends BaseRestHandler { | ||
|
||
private static final Logger logger = LogManager.getLogger(RestGetFieldMappingAction.class); | ||
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger); | ||
|
||
|
||
@Override | ||
public List<Route> routes() { | ||
return List.of( | ||
|
@@ -63,6 +70,12 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC | |
GetFieldMappingsRequest getMappingsRequest = new GetFieldMappingsRequest(); | ||
getMappingsRequest.indices(indices).fields(fields).includeDefaults(request.paramAsBoolean("include_defaults", false)); | ||
getMappingsRequest.indicesOptions(IndicesOptions.fromRequest(request, getMappingsRequest.indicesOptions())); | ||
|
||
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"); | ||
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. Maybe add a space between the two sentences? 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. Yep, added. |
||
} | ||
getMappingsRequest.local(request.paramAsBoolean("local", getMappingsRequest.local())); | ||
return channel -> | ||
client.admin().indices().getFieldMappings(getMappingsRequest, new RestBuilderListener<>(channel) { | ||
|
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 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?
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.
Added. Thanks for the heads up about the migrate doc. Will do for 7.x.