-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Remove comma-separated feature parsing for GetIndicesAction #24723
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 comma-separated feature parsing for GetIndicesAction #24723
Conversation
8211d12
to
3ac55ad
Compare
@jasontedor could you take a look at this? This is the PR you asked me to separate from #24437 |
|
||
[source,js] | ||
-------------------------------------------------- | ||
GET twitter/_settings,_mappings |
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.
This could just be changed to
GET twitter?filter_path=*.settings,*.mappings
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 could, but not sure it's worth it since I think this is a very minor edge case that people use.
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.
@dakrone I left some comments
writeAliases(response.aliases().get(index), builder, request); | ||
} | ||
builder.endObject(); | ||
|
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.
nit: extra newline
writeMappings(response.mappings().get(index), builder); | ||
} | ||
builder.endObject(); | ||
|
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.
nit: extra new line
writeSettings(response.settings().get(index), builder, request, defaults); | ||
} | ||
builder.endObject(); | ||
|
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.
nit: extra newline
|
||
==== Indices information APIs | ||
|
||
Previously it was possible to do `GET /_aliases,_mappings` or `GET |
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/do/execute
Previously it was possible to do `GET /_aliases,_mappings` or `GET | ||
/myindex/_settings,_alias` by separating mulitple types of requests with commas | ||
in order to retrieve multiple types of information about one or more indices. | ||
This comma-separation for multiple information retrieval has been removed. `GET |
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/multiple information retrieval/retrieving multiple pieces of information
final XContentBuilder builder) throws IOException { | ||
builder.startObject("mappings"); | ||
{ | ||
if (mappings != null) { |
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.
Under what circumstances would the mappings for an index be null (as opposed to an empty map)? It seems the default for GetIndexResponse
is to always have an empty map for mappings (and aliases and settings) and it would only get assigned to a non-null map.
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 don't think they ever would be, this is a carryover from when I copied this from the other method. I'll remove it.
- do: | ||
indices.get: | ||
index: test_index | ||
feature: _mapping |
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'm not clear on why this test was eliminated, because we still support {index}/_mapping by its own without the comma-separated multi values?
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.
This test was eliminated because it was for the indices.get
API, whereas we already have tests for the indices.get_mapping
API (in another file), so this was just a duplicate test.
- do: | ||
indices.get: | ||
index: test_blias | ||
feature: _mapping |
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.
Ditto to the comment 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.
Same about the duplicated test
|
||
--- | ||
"Get index infos with human settings should return index creation date and version in readable format": | ||
|
||
- do: | ||
indices.get: | ||
index: test_index | ||
feature: _settings |
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.
Ditto to the comment 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.
Same about the duplicated test :)
@@ -4,17 +4,12 @@ | |||
"methods":[ "GET" ], | |||
"url":{ | |||
"path":"/{index}", | |||
"paths":[ "/{index}", "/{index}/{feature}" ], |
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.
Should we also add rest specs and yaml tests for the new REST endpoints introduced in this PR?
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.
Interestingly enough, we already do have these endpoints in the spec, they just weren't in this file :)
Thanks @abeyad, I pushed some commits addressing your feedback |
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.
LGTM, thanks @dakrone
7577dc9
to
3581e37
Compare
This removes the parsing of things like `GET /idx/_aliases,_mappings`, instead, a user must choose between retriving all index metadata with `GET /idx`, or only a specific form such as `GET /idx/_settings`. Relates to (and is a prerequisite of) elastic#24437
3581e37
to
a32d1b9
Compare
thank you @abeyad :) |
Are we going to also deprecate this in 5.x? |
Good idea, I'll open a PR |
This is the deprecation logging and documentation for 5.x related to elastic#24723. It logs when a user does a request like: ``` GET /index/_alias,_mapping ```
* Add deprecation logging for comma-separated feature parsing This is the deprecation logging and documentation for 5.x related to #24723. It logs when a user does a request like: ``` GET /index/_alias,_mapping ```
Previously this would output: ``` GET /test-1/_mappings { } ``` And after this change: ``` GET /test-1/_mappings { "test-1": { "mappings": {} } } ``` To bring parity back to the REST output after elastic#24723. Relates to elastic#25090
Previously in elastic#24723 we changed the `_alias` API to not go through the `RestGetIndicesAction` endpoint, instead creating a `RestGetAliasesAction` that did the same thing. This changes the formatting so that it matches the old formatting of the endpoint, before: ``` GET /test-1/_alias { } ``` And after this change: ``` GET /test-1/_alias { "test-1": { "aliases": {} } } ``` This is related to elastic#25090
Removes dead code. Follow-up of #24723
Removes dead code. Follow-up of #24723
This removes the parsing of things like
GET /idx/_aliases,_mappings
, instead,a user must choose between retriving all index metadata with
GET /idx
, or onlya specific form such as
GET /idx/_settings
.Relates to (and is a prerequisite of) #24437