diff --git a/spec/namespaces/indices.yaml b/spec/namespaces/indices.yaml index 5c35abfd8..b2b0e64de 100644 --- a/spec/namespaces/indices.yaml +++ b/spec/namespaces/indices.yaml @@ -409,9 +409,7 @@ paths: url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/indices.simulate_index_template::path.name' - - $ref: '#/components/parameters/indices.simulate_index_template::query.cause' - $ref: '#/components/parameters/indices.simulate_index_template::query.cluster_manager_timeout' - - $ref: '#/components/parameters/indices.simulate_index_template::query.create' - $ref: '#/components/parameters/indices.simulate_index_template::query.master_timeout' requestBody: $ref: '#/components/requestBodies/indices.simulate_index_template' @@ -4867,14 +4865,6 @@ components: schema: $ref: '../schemas/_common.yaml#/components/schemas/Name' style: simple - indices.simulate_index_template::query.cause: - name: cause - in: query - description: User defined reason for dry-run creating the new template for simulation purposes. - schema: - type: string - default: 'false' - description: User defined reason for dry-run creating the new template for simulation purposes. indices.simulate_index_template::query.cluster_manager_timeout: name: cluster_manager_timeout in: query @@ -4882,19 +4872,6 @@ components: schema: $ref: '../schemas/_common.yaml#/components/schemas/Duration' x-version-added: '2.0' - indices.simulate_index_template::query.create: - in: query - name: create - description: |- - If `true`, the template passed in the body is only used if no existing - templates match the same index patterns. If `false`, the simulation uses - the template with the highest priority. Note that the template is not - permanently added or updated in either case; it is only used for the - simulation. - schema: - type: boolean - default: false - style: form indices.simulate_index_template::query.master_timeout: in: query name: master_timeout diff --git a/spec/schemas/indices.simulate_template.yaml b/spec/schemas/indices.simulate_template.yaml index 33e87f80b..f4d616db1 100644 --- a/spec/schemas/indices.simulate_template.yaml +++ b/spec/schemas/indices.simulate_template.yaml @@ -31,5 +31,4 @@ components: $ref: 'indices._common.yaml#/components/schemas/IndexSettings' required: - aliases - - mappings - settings diff --git a/tests/default/indices/index_template/simulate.yaml b/tests/default/indices/index_template/simulate.yaml new file mode 100644 index 000000000..4ad9c0839 --- /dev/null +++ b/tests/default/indices/index_template/simulate.yaml @@ -0,0 +1,44 @@ +$schema: ../../../../json_schemas/test_story.schema.yaml + +description: Test index configuration that would be applied by a particular index template. +epilogues: + - path: /_index_template/daily_logs + method: DELETE + status: [200, 404] +prologues: + - path: /_index_template/daily_logs + method: POST + request: + payload: + index_patterns: + - 'logs*' + priority: 0 + template: + mappings: + properties: + text: + type: text + settings: + number_of_shards: 2 + number_of_replicas: 2 +chapters: + - synopsis: Simulate a template configuration. + path: /_index_template/_simulate + method: POST + parameters: + cause: Testing. + create: false + request: + payload: + index_patterns: + - 'logs*' + priority: 1 + template: + settings: + number_of_shards: 2 + number_of_replicas: 2 + - synopsis: Get the index configuration that would be applied by the `daily_logs` index template. + path: /_index_template/_simulate/{name} + method: POST + parameters: + name: daily_logs diff --git a/tests/default/indices/index_template/simulate_index.yaml b/tests/default/indices/index_template/simulate_index.yaml new file mode 100644 index 000000000..3619d063a --- /dev/null +++ b/tests/default/indices/index_template/simulate_index.yaml @@ -0,0 +1,29 @@ +$schema: ../../../../json_schemas/test_story.schema.yaml + +description: Test index configuration that would be applied by a particular index template. +prologues: + - path: /_index_template/daily_logs + method: POST + request: + payload: + index_patterns: + - 'logs*' + priority: 0 + template: + mappings: + properties: + text: + type: text + settings: + number_of_shards: 2 + number_of_replicas: 2 +epilogues: + - path: /_index_template/daily_logs + method: DELETE + status: [200, 404] +chapters: + - synopsis: Simulate matching the `logs-today` name against the `logs*` index template. + path: /_index_template/_simulate_index/{name} + method: POST + parameters: + name: logs-today \ No newline at end of file