Skip to content

Commit

Permalink
Add examples for simulate APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
lcawl committed Jan 6, 2025
1 parent 6387891 commit daaa778
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 12 deletions.
4 changes: 2 additions & 2 deletions output/openapi/elasticsearch-openapi.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions output/openapi/elasticsearch-serverless-openapi.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions output/schema/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions specification/_doc_ids/table.csv
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ indices-rollover-index,https://www.elastic.co/guide/en/elasticsearch/reference/{
indices-segments,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-segments.html
indices-shards-stores,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-shards-stores.html
indices-shrink-index,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-shrink-index.html
indices-simulate,https://www.elastic.co/guide/en/elasticsearch/reference/{master}/indices-simulate-index.html
indices-simulate-template,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-simulate-template.html
indices-split-index,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-split-index.html
indices-stats,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-stats.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { Duration } from '@_types/Time'
* @rest_spec_name indices.simulate_index_template
* @availability stack since=7.9.0 stability=stable
* @availability serverless stability=stable visibility=public
* @doc_id indices-simulate-template
* @doc_id indices-simulate
* @cluster_privileges manage_index_templates
*/
export interface Request extends RequestBase {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# summary: indices/simulate-index.asciidoc:188
description: A successful response from `POST /_index_template/_simulate_index/my-index-000001`.
# type: response
# response_code: 200
value: "{\n \"template\" : {\n \"settings\" : {\n \"index\" : {\n \
\ \"number_of_shards\" : \"2\",\n \"number_of_replicas\" : \"0\",\n \
\ \"routing\" : {\n \"allocation\" : {\n \"include\" : {\n\
\ \"_tier_preference\" : \"data_content\"\n }\n \
\ }\n }\n }\n },\n \"mappings\" : {\n \"properties\" : {\n\
\ \"@timestamp\" : {\n \"type\" : \"date\"\n }\n }\n\
\ },\n \"aliases\" : { }\n },\n \"overlapping\" : [\n {\n \"name\"\
\ : \"template_1\",\n \"index_patterns\" : [\n \"my-index-*\"\n \
\ ]\n }\n ]\n}"
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ import { Duration } from '@_types/Time'

/**
* Simulate an index template.
* Returns the index configuration that would be applied by a particular index template.
* Get the index configuration that would be applied by a particular index template.
* @rest_spec_name indices.simulate_template
* @availability stack stability=stable
* @availability serverless stability=stable visibility=public
* @cluster_privileges manage_index_templates
* @doc_id indices-simulate-template
*/
export interface Request extends RequestBase {
path_parts: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# summary:
# method_request: POST /_index_template/_simulate
description: >
To see what settings will be applied by a template before you add it to the cluster, you can pass a template configuration in the request body.
The specified template is used for the simulation if it has a higher priority than existing templates.
# type: request
value: "{\n \"index_patterns\": [\"my-index-*\"],\n \"composed_of\": [\"ct2\"],\n\
\ \"priority\": 10,\n \"template\": {\n \"settings\": {\n \"index.number_of_replicas\"\
: 1\n }\n }\n}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# summary:
description: >
A successful response from `POST /_index_template/_simulate` with a template configuration in the request body.
The response shows any overlapping templates with a lower priority.
# type: response
# response_code: 200
value: "{\n \"template\" : {\n \"settings\" : {\n \"index\" : {\n \
\ \"number_of_replicas\" : \"1\",\n \"routing\" : {\n \"allocation\"\
\ : {\n \"include\" : {\n \"_tier_preference\" : \"data_content\"\
\n }\n }\n }\n }\n },\n \"mappings\" : {\n\
\ \"properties\" : {\n \"@timestamp\" : {\n \"type\" : \"date\"\
\n }\n }\n },\n \"aliases\" : { }\n },\n \"overlapping\" : [\n\
\ {\n \"name\" : \"final-template\",\n \"index_patterns\" : [\n \
\ \"my-index-*\"\n ]\n }\n ]\n}"

0 comments on commit daaa778

Please sign in to comment.