Skip to content
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 template simulation API for simulating template composition #56842

Merged
merged 6 commits into from May 18, 2020

Conversation

@dakrone
Copy link
Member

dakrone commented May 15, 2020

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

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
@elasticmachine
Copy link
Collaborator

elasticmachine commented May 15, 2020

Pinging @elastic/es-core-features (:Core/Features/Indices APIs)

.startObject()
.field(MapperService.SINGLE_MAPPING_NAME, mappings)
.endObject());
Comment on lines -120 to -122

This comment has been minimized.

Copy link
@dakrone

dakrone May 15, 2020

Author Member

@andreidan I had to remove this wrapping because the simulated documents came back with the _doc parameter in the mappings, and they can't be sent as new component or index templates with _doc in the mappings

@dakrone dakrone added the :ES-UI label May 15, 2020
@elasticmachine
Copy link
Collaborator

elasticmachine commented May 15, 2020

Pinging @elastic/es-ui (:ES-UI)

@dakrone
Copy link
Member Author

dakrone commented May 15, 2020

This also doesn't include HLRC support (yet), since it's already over 800 lines I figured it should be split into a separate PR.

@dakrone
Copy link
Member Author

dakrone commented May 15, 2020

@elasticmachine test this please

Copy link
Contributor

andreidan left a comment

Thanks for adding support for this Lee

This LGTM, left a couple of minor suggestions, but this looks great already

dakrone and others added 2 commits May 18, 2020
…mplate/post/TransportSimulateTemplateAction.java

Co-authored-by: Andrei Dan <andrei.dan@elastic.co>
@dakrone
Copy link
Member Author

dakrone commented May 18, 2020

@elasticmachine update branch

Copy link
Contributor

cjcenizal left a comment

I just reviewed the docs and had one comment. Thanks for adding this!

@dakrone dakrone merged commit d3ccada into elastic:master May 18, 2020
12 checks passed
12 checks passed
CLA All commits passed the check
Details
elasticsearch-ci/1 Build finished.
Details
elasticsearch-ci/2 Build finished.
Details
elasticsearch-ci/bwc Build finished.
Details
elasticsearch-ci/default-distro Build finished.
Details
elasticsearch-ci/docs Build finished.
Details
elasticsearch-ci/docs-check Build finished.
Details
elasticsearch-ci/oss-distro-docs Build finished.
Details
elasticsearch-ci/packaging-sample-matrix-windows Build finished.
Details
elasticsearch-ci/packaging-sample-unix-archives Build finished.
Details
elasticsearch-ci/packaging-sample-unix-docker Build finished.
Details
elasticsearch-ci/packaging-sample-unix-packages Build finished.
Details
@dakrone dakrone deleted the dakrone:itv2-add-simulate-template branch May 18, 2020
dakrone added a commit to dakrone/elasticsearch that referenced this pull request May 18, 2020
…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
dakrone added a commit that referenced this pull request May 19, 2020
Boda805 added a commit to Boda805/elasticsearch that referenced this pull request Jun 16, 2020
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.