-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Add simulate template composition API _index_template/_simulate_index/{name} #55686
Conversation
This adds a new api to simulate matching the given index name against the index templates in the system.
Pinging @elastic/es-core-features (:Core/Features/Indices APIs) |
@elasticmachine update branch |
@andreidan how would you feel about removing the "Post" prefix from the actions and class names? I think it sounds a little strange to call it |
Sure thing |
@dakrone renamed the classes |
@dakrone I think this is ready for review (removed the |
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.
Thanks for working on this Andrei! I left some comments about it
...n/java/org/elasticsearch/action/admin/indices/template/post/SimulateIndexTemplateAction.java
Outdated
Show resolved
Hide resolved
.../java/org/elasticsearch/action/admin/indices/template/post/SimulateIndexTemplateRequest.java
Show resolved
Hide resolved
rest-api-spec/src/main/resources/rest-api-spec/api/indices.simulate_index_template.json
Outdated
Show resolved
Hide resolved
...java/org/elasticsearch/action/admin/indices/template/post/SimulateIndexTemplateResponse.java
Outdated
Show resolved
Hide resolved
...g/elasticsearch/action/admin/indices/template/post/TransportSimulateIndexTemplateAction.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexService.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateService.java
Outdated
Show resolved
Hide resolved
Co-Authored-By: Lee Hinman <[email protected]>
Co-Authored-By: Lee Hinman <[email protected]>
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.
Thanks @andreidan! I left a couple more comments, but overall looks good!
...java/org/elasticsearch/action/admin/indices/template/post/SimulateIndexTemplateResponse.java
Outdated
Show resolved
Hide resolved
...g/elasticsearch/action/admin/indices/template/post/TransportSimulateIndexTemplateAction.java
Outdated
Show resolved
Hide resolved
...g/elasticsearch/action/admin/indices/template/post/TransportSimulateIndexTemplateAction.java
Show resolved
Hide resolved
...g/elasticsearch/action/admin/indices/template/post/TransportSimulateIndexTemplateAction.java
Outdated
Show resolved
Hide resolved
@elasticmachine update 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.
LGTM, thanks for iterating on this Andrei! I left one more comment about adding a test that also uses composed_of
(to make sure we resolve everything when simulating)
...-api-spec/src/main/resources/rest-api-spec/test/indices.simulate_index_template/10_basic.yml
Show resolved
Hide resolved
@elasticmachine update branch |
@elasticmachine run elasticsearch-ci/2 |
…/{name} (elastic#55686) This adds a new api to simulate matching the given index name against the index templates in the system. The syntax for the new API takes the following form: POST _index_template/_simulate_index/{index_name} { "index_patterns": ["logs-*"], "priority": 15, "template": { "settings": { "number_of_shards": 3 } ... } } Where the body is optional, but we support the entire body used by the PUT _index_template/{name} api. When the body is specified we'll simulate matching the given index against a system that'd have the given index template together with the index templates that exist in the system. The response, in both cases, will return the matching template's resolved settings, mappings and aliases, together with a special field that'll print any overlapping templates and their corresponding index patterns. (cherry picked from commit 1a5845e) Signed-off-by: Andrei Dan <[email protected]>
…_index/{name} (#55686) (#55922) This adds a new api to simulate matching the given index name against the index templates in the system. The syntax for the new API takes the following form: POST _index_template/_simulate_index/{index_name} { "index_patterns": ["logs-*"], "priority": 15, "template": { "settings": { "number_of_shards": 3 } ... } } Where the body is optional, but we support the entire body used by the PUT _index_template/{name} api. When the body is specified we'll simulate matching the given index against a system that'd have the given index template together with the index templates that exist in the system. The response, in both cases, will return the matching template's resolved settings, mappings and aliases, together with a special field that'll print any overlapping templates and their corresponding index patterns. (cherry picked from commit 1a5845e) Signed-off-by: Andrei Dan <[email protected]>
As elastic#55686 was backported the simulate index template api is no available in 7.8.
As #55686 was backported the simulate index template api is no available in 7.8.
This adds an API for simulating template composition with or without an index template. It looks like: ``` POST /_index_template/_simulate/my-template ``` To simulate a template named `my-template` that already exists, or, to simulate a template that does not already exist: ``` POST /_index_template/_simulate { "index_patterns": ["my-index"] "composed_of": ["ct1", "ct2"], } ``` This is related to elastic#55686, which adds an API to simulate composition based on an index name (hence the `_simulate_index` vs `_simulate`). This commit also adds reference documentation for both simulation APIs. Relates to elastic#53101 Resolves elastic#56390 Resolves elastic#56255
This adds an API for simulating template composition with or without an index template. It looks like: ``` POST /_index_template/_simulate/my-template ``` To simulate a template named `my-template` that already exists, or, to simulate a template that does not already exist: ``` POST /_index_template/_simulate { "index_patterns": ["my-index"] "composed_of": ["ct1", "ct2"], } ``` This is related to #55686, which adds an API to simulate composition based on an index name (hence the `_simulate_index` vs `_simulate`). This commit also adds reference documentation for both simulation APIs. Relates to #53101 Resolves #56390 Resolves #56255
…tic#56842) This adds an API for simulating template composition with or without an index template. It looks like: ``` POST /_index_template/_simulate/my-template ``` To simulate a template named `my-template` that already exists, or, to simulate a template that does not already exist: ``` POST /_index_template/_simulate { "index_patterns": ["my-index"] "composed_of": ["ct1", "ct2"], } ``` This is related to elastic#55686, which adds an API to simulate composition based on an index name (hence the `_simulate_index` vs `_simulate`). This commit also adds reference documentation for both simulation APIs. Relates to elastic#53101 Resolves elastic#56390 Resolves elastic#56255
This adds a new api to simulate matching the given index name against the
index templates in the system.
The syntax for the new API takes the following form:
Where the body is optional, but we support the entire body used by the
PUT _index_template/{name}
api. When the body is specified we'll simulatematching the given index against a system that'd have the given index
template together with the index templates that exist in the system.
The response, in both cases, will return the matching template's resolved
settings, mappings and aliases, together with a special field that'll print any
overlapping templates and their corresponding index patterns.
Relates to #53101