Skip to content

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

Merged
merged 1 commit into from
Jun 2, 2017

Conversation

dakrone
Copy link
Member

@dakrone dakrone commented May 16, 2017

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) #24437

@dakrone dakrone added :Core/Infra/REST API REST infrastructure and utilities >breaking v6.0.0 labels May 16, 2017
@dakrone dakrone requested a review from jasontedor May 16, 2017 21:50
@dakrone dakrone force-pushed the remove-comma-parsing-of-features branch 3 times, most recently from 8211d12 to 3ac55ad Compare May 18, 2017 20:15
@dakrone
Copy link
Member Author

dakrone commented May 30, 2017

@jasontedor could you take a look at this? This is the PR you asked me to separate from #24437

@abeyad abeyad self-requested a review June 2, 2017 15:09

[source,js]
--------------------------------------------------
GET twitter/_settings,_mappings
Copy link
Member

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

Copy link
Member Author

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.

Copy link

@abeyad abeyad left a 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();

Copy link

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();

Copy link

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();

Copy link

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
Copy link

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
Copy link

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) {
Copy link

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.

Copy link
Member Author

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
Copy link

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?

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 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
Copy link

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

Copy link
Member Author

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
Copy link

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

Copy link
Member Author

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}" ],
Copy link

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?

Copy link
Member Author

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 :)

See: https://github.com/dakrone/elasticsearch/blob/remove-comma-parsing-of-features/rest-api-spec/src/main/resources/rest-api-spec/api/indices.get_mapping.json#L7

@dakrone
Copy link
Member Author

dakrone commented Jun 2, 2017

Thanks @abeyad, I pushed some commits addressing your feedback

Copy link

@abeyad abeyad left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @dakrone

@dakrone dakrone force-pushed the remove-comma-parsing-of-features branch 2 times, most recently from 7577dc9 to 3581e37 Compare June 2, 2017 20:40
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
@dakrone dakrone force-pushed the remove-comma-parsing-of-features branch from 3581e37 to a32d1b9 Compare June 2, 2017 20:43
@dakrone dakrone merged commit a32d1b9 into elastic:master Jun 2, 2017
@dakrone
Copy link
Member Author

dakrone commented Jun 2, 2017

thank you @abeyad :)

@javanna
Copy link
Member

javanna commented Jun 2, 2017

Are we going to also deprecate this in 5.x?

@dakrone
Copy link
Member Author

dakrone commented Jun 2, 2017

Are we going to also deprecate this in 5.x?

Good idea, I'll open a PR

dakrone added a commit to dakrone/elasticsearch that referenced this pull request Jun 2, 2017
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
```
dakrone added a commit that referenced this pull request Jun 3, 2017
dakrone added a commit that referenced this pull request Jun 5, 2017
* 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
```
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Jun 7, 2017
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
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Jun 8, 2017
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
dakrone added a commit that referenced this pull request Jun 8, 2017
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 #24723.

Relates to #25090
@dakrone dakrone deleted the remove-comma-parsing-of-features branch December 13, 2017 20:37
ywelsch added a commit to ywelsch/elasticsearch that referenced this pull request Feb 6, 2018
ywelsch added a commit that referenced this pull request Feb 6, 2018
ywelsch added a commit that referenced this pull request Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking :Core/Infra/REST API REST infrastructure and utilities v6.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants