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

Fixed /_index_template/_simulate*. #691

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,25 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added `rename_alias_pattern` and `rename_alias_replacement` to `/_snapshot/{repository}/{snapshot}/_restore` body parameters ([#615](https://github.com/opensearch-project/opensearch-api-specification/pull/615))
- Added `resource_stats` to `TaskInfoBase` ([#692](https://github.com/opensearch-project/opensearch-api-specification/pull/692))
- Added `s` to `/_ingest/processor/grok` ([#689](https://github.com/opensearch-project/opensearch-api-specification/pull/689))
- Added schema for security API error responses ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Added `aggregations` to `/nodes/_usage/{metric}` requests and responses ([#615](https://github.com/opensearch-project/opensearch-api-specification/pull/615))

### Removed
- Removed unsupported `_common.mapping:SourceField`'s `mode` field and associated `_common.mapping:SourceFieldMode` enum ([#652](https://github.com/opensearch-project/opensearch-api-specification/pull/652))
- Removed unsupported `_common.mapping:DenseVectorProperty`, `_common.mapping:SparseVectorProperty`, and `_common.mapping:FlattenedProperty` ([#666](https://github.com/opensearch-project/opensearch-api-specification/pull/666))
- Removed unsupported time series dimension properties and types ([#666](https://github.com/opensearch-project/opensearch-api-specification/pull/666))
- Removed unsupported runtime field properties (`script`/`on_script_error`) on `NumberPropertyBase` ([#666](https://github.com/opensearch-project/opensearch-api-specification/pull/666))
- Removed unsupported `script` and `on_script_error` from `NumberPropertyBase` ([#666](https://github.com/opensearch-project/opensearch-api-specification/pull/666))
- Removed unsupported `required` from `ppl` responses ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Removed invalid `externalDocs` from `flow_framework.create/update::query.use_case` ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Removed unsupported `cause` and `create` from `/_index_template/_simulate_index/{name}` ([#691](https://github.com/opensearch-project/opensearch-api-specification/pull/691))
- Removed `mappings` from `required` in `indices.simulate_template#Template` ([#691](https://github.com/opensearch-project/opensearch-api-specification/pull/691))

### Fixed
- Spec passes OpenAPI 3.1.0 validations ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Disallowed characters (`::`, `@`, and `:`) in key names are replaced with `___` on merge ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Added missing `required` to `path` parameters ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Added missing `schema` parent to response types ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Removed invalid `externalDocs` from `flow_framework.create/update::query.use_case` ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Fixed incorrect `style` in `indices.get_mapping::query.index` ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Removed invalid `required` from `ppl` responses ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Added schema for security API error responses ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Fixed `/{index}/_create/{id}` returning `201` ([#669](https://github.com/opensearch-project/opensearch-api-specification/pull/669))
- Fixed `ml._common.yaml#SearchModelsResponse` and `SearchModelsHitsHit` ([#672](https://github.com/opensearch-project/opensearch-api-specification/pull/672))
- Fixed `refresh` options to allow `boolean` and `string` ([#673](https://github.com/opensearch-project/opensearch-api-specification/pull/673))
Expand Down
23 changes: 0 additions & 23 deletions spec/namespaces/indices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -4867,34 +4865,13 @@ 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
description: Operation timeout for connection to cluster-manager node.
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
Expand Down
1 change: 0 additions & 1 deletion spec/schemas/indices.simulate_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ components:
$ref: 'indices._common.yaml#/components/schemas/IndexSettings'
required:
- aliases
- mappings
- settings
44 changes: 44 additions & 0 deletions tests/default/indices/index_template/simulate.yaml
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions tests/default/indices/index_template/simulate_index.yaml
Original file line number Diff line number Diff line change
@@ -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