Skip to content

Commit

Permalink
Adds index API requests and responses - part 2 (#2993)
Browse files Browse the repository at this point in the history
Co-authored-by: Lisa Cawley <[email protected]>
  • Loading branch information
szabosteve and lcawl authored Dec 10, 2024
1 parent 2045505 commit f65ad48
Show file tree
Hide file tree
Showing 14 changed files with 242 additions and 23 deletions.
48 changes: 43 additions & 5 deletions docs/overlays/elasticsearch-openapi-overlays.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ actions:
- target: "$.paths['/_ilm/policy/{policy}']['put']"
description: "Add examples for create a lifecycle operation"
update:
update:
requestBody:
content:
application/json:
Expand All @@ -188,7 +187,6 @@ actions:
- target: "$.paths['/_ilm/migrate_to_data_tiers']['post']"
description: "Add examples for migrate to data tiers routing operation"
update:
update:
requestBody:
content:
application/json:
Expand All @@ -205,7 +203,6 @@ actions:
- target: "$.paths['/_ilm/move/{index}']['post']"
description: "Add examples for move to lifecycle step operation"
update:
update:
requestBody:
content:
application/json:
Expand Down Expand Up @@ -338,7 +335,6 @@ actions:
- target: "$.paths['/_autoscaling/policy/{name}']['put']"
description: "Add examples for create autoscaling policy operation"
update:
update:
requestBody:
content:
application/json:
Expand All @@ -353,4 +349,46 @@ actions:
application/json:
examples:
createAutoscalingPolicyResponseExample1:
$ref: "../../specification/autoscaling/put_autoscaling_policy/autoscalingApisPutAutoscalingPolicyResponseExample1.yaml"
$ref: "../../specification/autoscaling/put_autoscaling_policy/autoscalingApisPutAutoscalingPolicyResponseExample1.yaml"
- target: "$.components['responses']['indices.recovery#200']"
description: "Add example for get index recovery response"
update:
content:
application/json:
examples:
getIndicesRecoveryResponseExample1:
$ref: "../../specification/indices/recovery/indicesRecoveryResponseExample1.yaml"
- target: "$.paths['/_resolve/cluster/{name}']['get']"
description: "Add examples for resolve cluster operation"
update:
responses:
200:
content:
application/json:
examples:
resolveClusterResponseExample1:
$ref: "../../specification/indices/resolve_cluster/ResolveClusterResponseExample1.yaml"
- target: "$.components['requestBodies']['indices.shrink']"
description: "Add example for shrink index request"
update:
content:
application/json:
examples:
indicesShrinkRequestExample1:
$ref: "../../specification/indices/shrink/indicesShrinkRequestExample1.yaml"
- target: "$.components['requestBodies']['indices.split']"
description: "Add example for split index request"
update:
content:
application/json:
examples:
indicesSplitRequestExample1:
$ref: "../../specification/indices/split/indicesSplitRequestExample1.yaml"
- target: "$.components['requestBodies']['indices.put_template']"
description: "Add example for legacy create template request"
update:
content:
application/json:
examples:
indicesLegacyPutTemplateRequestExample1:
$ref: "../../specification/indices/put_template/indicesPutTemplateRequestExample1.yaml"
34 changes: 17 additions & 17 deletions docs/overlays/elasticsearch-serverless-openapi-overlays.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ actions:
- target: '$.components'
description: Add securitySchemes
update:
securitySchemes:
apiKeyAuth:
description: |
Elasticsearch APIs use key-based authentication.
You must create an API key and use the encoded value in the request header.
For example:
```
curl -X GET "${ES_URL}/_cat/indices?v=true" \
-H "Authorization: ApiKey ${API_KEY}"
```
To get API keys for the Elasticsearch endpoint (${ES_URL}) for a project, refer to [Connect to your Elasticsearch Serverless endpoint](https://www.elastic.co/guide/en/serverless/current/elasticsearch-connecting-to-es-serverless-endpoint.html).
in: header
name: Authorization
type: apiKey
securitySchemes:
apiKeyAuth:
description: |
Elasticsearch APIs use key-based authentication.
You must create an API key and use the encoded value in the request header.
For example:
```
curl -X GET "${ES_URL}/_cat/indices?v=true" \
-H "Authorization: ApiKey ${API_KEY}"
```
To get API keys for the Elasticsearch endpoint (${ES_URL}) for a project, refer to [Connect to your Elasticsearch Serverless endpoint](https://www.elastic.co/guide/en/serverless/current/elasticsearch-connecting-to-es-serverless-endpoint.html).
in: header
name: Authorization
type: apiKey
- target: '$'
description: Add document security
update:
Expand Down
51 changes: 50 additions & 1 deletion docs/overlays/elasticsearch-shared-overlays.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1293,4 +1293,53 @@ actions:
examples:
simulatePipelineResponseExample1:
$ref: "../../specification/ingest/simulate/SimulatePipelineResponseExample1.yaml"

- target: "$.components['requestBodies']['indices.put_index_template']"
description: "Add example for create index template request"
update:
content:
application/json:
examples:
indicesPutIndexTemplateRequestExample1:
$ref: "../../specification/indices/put_index_template/indicesPutIndexTemplateRequestExample1.yaml"
- target: "$.components['requestBodies']['indices.put_mapping']"
description: "Add example for update mapping request"
update:
content:
application/json:
examples:
indicesPutSettingRequestExample1:
$ref: "../../specification/indices/put_mapping/indicesPutMappingRequestExample1.yaml"
- target: "$.components['requestBodies']['indices.put_settings']"
description: "Add example for update index settings request"
update:
content:
application/json:
examples:
indicesPutSettingRequestExample1:
$ref: "../../specification/indices/put_settings/IndicesPutSettingsRequestExample1.yaml"
- target: "$.paths['/_resolve/index/{name}']['get']"
description: "Add examples for resolve index operation"
update:
responses:
200:
content:
application/json:
examples:
indicesResolveResponseExample1:
$ref: "../../specification/indices/resolve_index/indicesResolveResponseExample1.yaml"
- target: "$.components['requestBodies']['indices.rollover']"
description: "Add example for rollover index request"
update:
content:
application/json:
examples:
indicesRolloverRequestExample1:
$ref: "../../specification/indices/rollover/indicesRolloverRequestExample1.yaml"
- target: "$.components['responses']['indices.rollover#200']"
description: "Add example for rollover index response"
update:
content:
application/json:
examples:
indicesRolloverResponseExample1:
$ref: "../../specification/indices/rollover/indicesRolloverResponseExample1.yaml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
summary: Create an index template.
# method_request: PUT /_index_template/template_1
# description: ''
# type: request
value:
"{\n \"index_patterns\" : [\"template*\"],\n \"priority\" : 1,\n \"template\"\
: {\n \"settings\" : {\n \"number_of_shards\" : 2\n }\n }\n}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
summary: Create or update the mapping of an index.
# method_request: PUT /my-index-000001/_mapping
# description: ''
# type: request
value:
"{\n \"properties\": {\n \"email\": {\n \"type\": \"keyword\"\n \
\ }\n }\n}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
summary: Change a dynamic index setting in real time.
# method_request: PUT /my-index-000001/_settings
# description: ''
# type: request
value: "{\n \"index\" : {\n \"number_of_replicas\" : 2\n }\n}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
summary: Create or update an index template.
# method_request: PUT _template/template_1
# description: ''
# type: request
value:
index_patterns:
- 'te*'
- 'bar*'
settings:
number_of_shards: 1
mappings:
_source:
enabled: false
properties:
host_name:
type: keyword
created_at:
type: date
format: 'EEE MMM dd HH:mm:ss Z yyyy'
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
summary: A successful response for retrieving information about ongoing and completed shard recoveries for an index.
# description: ''
# type: response
response_code: 200
value:
"{\n \"index1\" : {\n \"shards\" : [ {\n \"id\" : 0,\n \"type\"\
\ : \"SNAPSHOT\",\n \"stage\" : \"INDEX\",\n \"primary\" : true,\n \
\ \"start_time\" : \"2014-02-24T12:15:59.716\",\n \"start_time_in_millis\"\
: 1393244159716,\n \"stop_time\" : \"0s\",\n \"stop_time_in_millis\" :\
\ 0,\n \"total_time\" : \"2.9m\",\n \"total_time_in_millis\" : 175576,\n\
\ \"source\" : {\n \"repository\" : \"my_repository\",\n \"snapshot\"\
\ : \"my_snapshot\",\n \"index\" : \"index1\",\n \"version\" : \"\
{version}\",\n \"restoreUUID\": \"PDh1ZAOaRbiGIVtCvZOMww\"\n },\n \
\ \"target\" : {\n \"id\" : \"ryqJ5lO5S4-lSFbGntkEkg\",\n \"host\"\
\ : \"my.fqdn\",\n \"transport_address\" : \"my.fqdn\",\n \"ip\" :\
\ \"10.0.1.7\",\n \"name\" : \"my_es_node\"\n },\n \"index\" :\
\ {\n \"size\" : {\n \"total\" : \"75.4mb\",\n \"total_in_bytes\"\
\ : 79063092,\n \"reused\" : \"0b\",\n \"reused_in_bytes\" : 0,\n\
\ \"recovered\" : \"65.7mb\",\n \"recovered_in_bytes\" : 68891939,\n\
\ \"recovered_from_snapshot\" : \"0b\",\n \"recovered_from_snapshot_in_bytes\"\
\ : 0,\n \"percent\" : \"87.1%\"\n },\n \"files\" : {\n \
\ \"total\" : 73,\n \"reused\" : 0,\n \"recovered\" :\
\ 69,\n \"percent\" : \"94.5%\"\n },\n \"total_time\" : \"\
0s\",\n \"total_time_in_millis\" : 0,\n \"source_throttle_time\" :\
\ \"0s\",\n \"source_throttle_time_in_millis\" : 0,\n \"target_throttle_time\"\
\ : \"0s\",\n \"target_throttle_time_in_millis\" : 0\n },\n \"\
translog\" : {\n \"recovered\" : 0,\n \"total\" : 0,\n \"percent\"\
\ : \"100.0%\",\n \"total_on_start\" : 0,\n \"total_time\" : \"0s\"\
,\n \"total_time_in_millis\" : 0\n },\n \"verify_index\" : {\n\
\ \"check_index_time\" : \"0s\",\n \"check_index_time_in_millis\"\
\ : 0,\n \"total_time\" : \"0s\",\n \"total_time_in_millis\" : 0\n\
\ }\n } ]\n }\n}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
summary: A successful response for resolving a specified index expression to return information about each cluster.
# description: ''
# type: response
response_code: 200
value:
"{\n \"(local)\": {\n \"connected\": true,\n \"skip_unavailable\": false,\n\
\ \"matching_indices\": true,\n \"version\": {\n \"number\": \"8.13.0\"\
,\n \"build_flavor\": \"default\",\n \"minimum_wire_compatibility_version\"\
: \"7.17.0\",\n \"minimum_index_compatibility_version\": \"7.0.0\"\n }\n\
\ },\n \"cluster_one\": {\n \"connected\": true,\n \"skip_unavailable\"\
: true,\n \"matching_indices\": true,\n \"version\": {\n \"number\":\
\ \"8.13.0\",\n \"build_flavor\": \"default\",\n \"minimum_wire_compatibility_version\"\
: \"7.17.0\",\n \"minimum_index_compatibility_version\": \"7.0.0\"\n }\n\
\ },\n \"cluster_two\": {\n \"connected\": true,\n \"skip_unavailable\"\
: false,\n \"matching_indices\": true,\n \"version\": {\n \"number\"\
: \"8.13.0\",\n \"build_flavor\": \"default\",\n \"minimum_wire_compatibility_version\"\
: \"7.17.0\",\n \"minimum_index_compatibility_version\": \"7.0.0\"\n }\n\
\ }\n}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
summary: A successful response for resolving the specified name for an index.
# description: ''
# type: response
response_code: 200
value:
"{\n \"indices\": [\n {\n \"name\": \"foo_closed\",\n \"attributes\"\
: [\n \"closed\"\n ]\n },\n {\n \"name\": \"freeze-index\"\
,\n \"aliases\": [\n \"f-alias\"\n ],\n \"attributes\": [\n\
\ \"open\"\n ]\n },\n {\n \"name\": \"remoteCluster1:bar-01\"\
,\n \"attributes\": [\n \"open\"\n ]\n }\n ],\n \"aliases\"\
: [\n {\n \"name\": \"f-alias\",\n \"indices\": [\n \"freeze-index\"\
,\n \"my-index-000001\"\n ]\n }\n ],\n \"data_streams\": [\n \
\ {\n \"name\": \"foo\",\n \"backing_indices\": [\n \".ds-foo-2099.03.07-000001\"\
\n ],\n \"timestamp_field\": \"@timestamp\"\n }\n ]\n}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
summary: Create a new index for a data stream.
# method_request: POST my-data-stream/_rollover
# description: ''
# type: request
value:
"{\n \"conditions\": {\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n\
\ \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\
\n }\n}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
summary: A successful response for creating a new index for a data stream.
# description: ''
# type: response
response_code: 200
value:
"{\n \"acknowledged\": true,\n \"shards_acknowledged\": true,\n \"old_index\"\
: \".ds-my-data-stream-2099.05.06-000001\",\n \"new_index\": \".ds-my-data-stream-2099.05.07-000002\"\
,\n \"rolled_over\": true,\n \"dry_run\": false,\n \"lazy\": false,\n \"conditions\"\
: {\n \"[max_age: 7d]\": false,\n \"[max_docs: 1000]\": true,\n \"[max_primary_shard_size:\
\ 50gb]\": false,\n \"[max_primary_shard_docs: 2000]\": false\n }\n}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
summary: Shrink an existing index into a new index with fewer primary shards.
# method_request: POST /my_source_index/_shrink/my_target_index
# description: ''
# type: request
value:
"{\n \"settings\": {\n \"index.routing.allocation.require._name\": null,\n\
\ \"index.blocks.write\": null\n }\n}"
5 changes: 5 additions & 0 deletions specification/indices/split/indicesSplitRequestExample1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
summary: Split an existing index into a new index with more primary shards.
# method_request: POST /my-index-000001/_split/split-my-index-000001
# description: ''
# type: request
value: "{\n \"settings\": {\n \"index.number_of_shards\": 2\n }\n}"

0 comments on commit f65ad48

Please sign in to comment.