- Notifications
You must be signed in to change notification settings - Fork 25.7k
Add mode filter to _resolve/index #133616
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
Changes from 18 commits
2278336 9a13bac bcac7ee 201ca9c b1c5d59 2957ec8 917210c dbb3906 2a65b5c 92df4ab ff8a3a1 7cdf9d9 4b0f835 9741bae d5fa638 bf68218 e07607a 0cbfcd7 24ac0e4 8b2974d File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pr: 133616 | ||
| summary: Add mode filter to _resolve/index | ||
| area: Indices APIs | ||
| type: enhancement | ||
| issues: [] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| --- | ||
| setup: | ||
| - do: | ||
| indices.create: | ||
| index: my-std-index | ||
| body: | ||
| settings: | ||
| number_of_shards: 1 | ||
| number_of_replicas: 0 | ||
| aliases: | ||
| my-std-alias: { } | ||
| | ||
| # Create a time-series index | ||
| - do: | ||
| indices.create: | ||
| index: my-ts-index | ||
| body: | ||
| settings: | ||
| index.mode: time_series | ||
| Member 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. It looks like we support a comma-delimited list, right? It would be good to exercise that somewhere in the yaml rest test. Contributor Author 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. Contributor Author 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. Or you mean an index with double mode when created? I have no idea what would happen then tbh... | ||
| number_of_shards: 1 | ||
| number_of_replicas: 0 | ||
| index.routing_path: [ "host" ] | ||
| mappings: | ||
| properties: | ||
| "@timestamp": | ||
| type: date | ||
| host: | ||
| type: keyword | ||
| time_series_dimension: true | ||
| metric: | ||
| type: keyword | ||
| value: | ||
| type: double | ||
| aliases: | ||
| my-ts-alias: { } | ||
| # Create a lookup index | ||
| - do: | ||
| indices.create: | ||
| index: my-lookup-index | ||
| body: | ||
| settings: | ||
| index.mode: lookup | ||
| aliases: | ||
| my-lookup-alias: { } | ||
| | ||
| --- | ||
| "resolve index filters by mode": | ||
| - requires: | ||
| test_runner_features: [ capabilities ] | ||
| capabilities: | ||
| - method: GET | ||
| path: /_resolve/index/* | ||
| capabilities: [ mode_filter ] | ||
| reason: "Need support for mode filtering in indices.resolve_index" | ||
| | ||
| - do: | ||
| indices.resolve_index: | ||
| name: 'my-*' | ||
| mode: lookup | ||
| - length: { indices: 1 } | ||
| - match: { indices.0.name: "my-lookup-index" } | ||
| - match: { indices.0.mode: "lookup" } | ||
| - match: { indices.0.aliases: [ "my-lookup-alias" ] } | ||
| - length: { aliases: 1 } | ||
| - match: { aliases.0.name: "my-lookup-alias" } | ||
| - match: { aliases.0.indices: [ "my-lookup-index" ] } | ||
| | ||
| --- | ||
| "resolve index filters by mode, multiple modes": | ||
| - requires: | ||
| test_runner_features: [ capabilities ] | ||
| capabilities: | ||
| - method: GET | ||
| path: /_resolve/index/* | ||
| capabilities: [ mode_filter ] | ||
| reason: "Need support for mode filtering in indices.resolve_index" | ||
| | ||
| - do: | ||
| indices.resolve_index: | ||
| name: 'my-*' | ||
| mode: time_series,standard | ||
| - length: { indices: 2 } | ||
| - match: { indices.0.name: "my-std-index" } | ||
| - match: { indices.0.mode: "standard" } | ||
| - match: { indices.0.aliases: [ "my-std-alias" ] } | ||
| - match: { indices.1.name: "my-ts-index" } | ||
| - match: { indices.1.mode: "time_series" } | ||
| - match: { indices.1.aliases: [ "my-ts-alias" ] } | ||
| - length: { aliases: 2 } | ||
| - match: { aliases.0.name: "my-std-alias" } | ||
| - match: { aliases.0.indices: [ "my-std-index" ] } | ||
| - match: { aliases.1.name: "my-ts-alias" } | ||
| - match: { aliases.1.indices: [ "my-ts-index" ] } | ||
| | ||
| --- | ||
| teardown: | ||
| - do: | ||
| indices.delete: | ||
| index: my-std-index | ||
| ignore_unavailable: true | ||
| - do: | ||
| indices.delete: | ||
| index: my-ts-index | ||
| ignore_unavailable: true | ||
| - do: | ||
| indices.delete: | ||
| index: my-lookup-index | ||
| ignore_unavailable: true | ||
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.
Is there a way to specify that the default is "all modes"? If not, are there any other (non-automated) docs where we can document this? I haven't grokked the new docs model for 9x.
Uh oh!
There was an error while loading. Please reload this page.
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 sure if there's a way to express this in this JSON. There's another spec in elasticsearch-specification repo which I'll update, I think that one is in Typescript and has more expressive power.
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.
You can indeed specify a default. Here's an example:
elasticsearch/rest-api-spec/src/main/resources/rest-api-spec/api/eql.get.json
Line 36 in 5ab8b57
That said, I'm working on generating rest-api-spec from https://github.com/elastic/elasticsearch-specification and ultimately moving it into the Elasticsearch repo, so that's the important part. And there, defaults are specified with the @server_default annotation.