Skip to content

Add template simulation API for simulating template composition#56842

Merged
dakrone merged 6 commits intoelastic:masterfrom
dakrone:itv2-add-simulate-template
May 18, 2020
Merged

Add template simulation API for simulating template composition#56842
dakrone merged 6 commits intoelastic:masterfrom
dakrone:itv2-add-simulate-template

Conversation

@dakrone
Copy link
Copy Markdown
Member

@dakrone 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 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 dakrone added :Data Management/Indices APIs DO NOT USE. Use ":Distributed/Indices APIs" or ":StorageEngine/Templates" instead. v8.0.0 v7.9.0 labels May 15, 2020
@dakrone dakrone requested a review from andreidan May 15, 2020 19:18
@elasticmachine
Copy link
Copy Markdown
Collaborator

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

@elasticmachine elasticmachine added the Team:Data Management (obsolete) DO NOT USE. This team no longer exists. label May 15, 2020
Comment on lines -120 to -122
.startObject()
.field(MapperService.SINGLE_MAPPING_NAME, mappings)
.endObject());
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@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
Copy Markdown
Collaborator

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

@elasticmachine elasticmachine added the Team:Deployment Management Meta label for Management Experience - Deployment Management team label May 15, 2020
@dakrone
Copy link
Copy Markdown
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
Copy Markdown
Member Author

dakrone commented May 15, 2020

@elasticmachine test this please

Copy link
Copy Markdown
Contributor

@andreidan andreidan left a comment

Choose a reason for hiding this comment

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

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 12:18
…mplate/post/TransportSimulateTemplateAction.java

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

dakrone commented May 18, 2020

@elasticmachine update branch

Copy link
Copy Markdown
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

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

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

@dakrone dakrone merged commit d3ccada into elastic:master May 18, 2020
@dakrone dakrone deleted the itv2-add-simulate-template branch May 18, 2020 21:11
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
@jakelandis jakelandis removed the v8.0.0 label Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Data Management/Indices APIs DO NOT USE. Use ":Distributed/Indices APIs" or ":StorageEngine/Templates" instead. >enhancement Team:Data Management (obsolete) DO NOT USE. This team no longer exists. Team:Deployment Management Meta label for Management Experience - Deployment Management team v7.9.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add dedicated simulation API for simulating a template without an index API endpoint for previewing composed result of an index template v2

6 participants