Skip to content

Commit f65ad48

Browse files
szabostevelcawl
andauthored
Adds index API requests and responses - part 2 (#2993)
Co-authored-by: Lisa Cawley <[email protected]>
1 parent 2045505 commit f65ad48

14 files changed

+242
-23
lines changed

docs/overlays/elasticsearch-openapi-overlays.yaml

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ actions:
163163
- target: "$.paths['/_ilm/policy/{policy}']['put']"
164164
description: "Add examples for create a lifecycle operation"
165165
update:
166-
update:
167166
requestBody:
168167
content:
169168
application/json:
@@ -188,7 +187,6 @@ actions:
188187
- target: "$.paths['/_ilm/migrate_to_data_tiers']['post']"
189188
description: "Add examples for migrate to data tiers routing operation"
190189
update:
191-
update:
192190
requestBody:
193191
content:
194192
application/json:
@@ -205,7 +203,6 @@ actions:
205203
- target: "$.paths['/_ilm/move/{index}']['post']"
206204
description: "Add examples for move to lifecycle step operation"
207205
update:
208-
update:
209206
requestBody:
210207
content:
211208
application/json:
@@ -338,7 +335,6 @@ actions:
338335
- target: "$.paths['/_autoscaling/policy/{name}']['put']"
339336
description: "Add examples for create autoscaling policy operation"
340337
update:
341-
update:
342338
requestBody:
343339
content:
344340
application/json:
@@ -353,4 +349,46 @@ actions:
353349
application/json:
354350
examples:
355351
createAutoscalingPolicyResponseExample1:
356-
$ref: "../../specification/autoscaling/put_autoscaling_policy/autoscalingApisPutAutoscalingPolicyResponseExample1.yaml"
352+
$ref: "../../specification/autoscaling/put_autoscaling_policy/autoscalingApisPutAutoscalingPolicyResponseExample1.yaml"
353+
- target: "$.components['responses']['indices.recovery#200']"
354+
description: "Add example for get index recovery response"
355+
update:
356+
content:
357+
application/json:
358+
examples:
359+
getIndicesRecoveryResponseExample1:
360+
$ref: "../../specification/indices/recovery/indicesRecoveryResponseExample1.yaml"
361+
- target: "$.paths['/_resolve/cluster/{name}']['get']"
362+
description: "Add examples for resolve cluster operation"
363+
update:
364+
responses:
365+
200:
366+
content:
367+
application/json:
368+
examples:
369+
resolveClusterResponseExample1:
370+
$ref: "../../specification/indices/resolve_cluster/ResolveClusterResponseExample1.yaml"
371+
- target: "$.components['requestBodies']['indices.shrink']"
372+
description: "Add example for shrink index request"
373+
update:
374+
content:
375+
application/json:
376+
examples:
377+
indicesShrinkRequestExample1:
378+
$ref: "../../specification/indices/shrink/indicesShrinkRequestExample1.yaml"
379+
- target: "$.components['requestBodies']['indices.split']"
380+
description: "Add example for split index request"
381+
update:
382+
content:
383+
application/json:
384+
examples:
385+
indicesSplitRequestExample1:
386+
$ref: "../../specification/indices/split/indicesSplitRequestExample1.yaml"
387+
- target: "$.components['requestBodies']['indices.put_template']"
388+
description: "Add example for legacy create template request"
389+
update:
390+
content:
391+
application/json:
392+
examples:
393+
indicesLegacyPutTemplateRequestExample1:
394+
$ref: "../../specification/indices/put_template/indicesPutTemplateRequestExample1.yaml"

docs/overlays/elasticsearch-serverless-openapi-overlays.yaml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ actions:
2323
- target: '$.components'
2424
description: Add securitySchemes
2525
update:
26-
securitySchemes:
27-
apiKeyAuth:
28-
description: |
29-
Elasticsearch APIs use key-based authentication.
30-
You must create an API key and use the encoded value in the request header.
31-
For example:
32-
33-
34-
```
35-
curl -X GET "${ES_URL}/_cat/indices?v=true" \
36-
-H "Authorization: ApiKey ${API_KEY}"
37-
```
38-
39-
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).
40-
in: header
41-
name: Authorization
42-
type: apiKey
26+
securitySchemes:
27+
apiKeyAuth:
28+
description: |
29+
Elasticsearch APIs use key-based authentication.
30+
You must create an API key and use the encoded value in the request header.
31+
For example:
32+
33+
34+
```
35+
curl -X GET "${ES_URL}/_cat/indices?v=true" \
36+
-H "Authorization: ApiKey ${API_KEY}"
37+
```
38+
39+
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).
40+
in: header
41+
name: Authorization
42+
type: apiKey
4343
- target: '$'
4444
description: Add document security
4545
update:

docs/overlays/elasticsearch-shared-overlays.yaml

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,4 +1293,53 @@ actions:
12931293
examples:
12941294
simulatePipelineResponseExample1:
12951295
$ref: "../../specification/ingest/simulate/SimulatePipelineResponseExample1.yaml"
1296-
1296+
- target: "$.components['requestBodies']['indices.put_index_template']"
1297+
description: "Add example for create index template request"
1298+
update:
1299+
content:
1300+
application/json:
1301+
examples:
1302+
indicesPutIndexTemplateRequestExample1:
1303+
$ref: "../../specification/indices/put_index_template/indicesPutIndexTemplateRequestExample1.yaml"
1304+
- target: "$.components['requestBodies']['indices.put_mapping']"
1305+
description: "Add example for update mapping request"
1306+
update:
1307+
content:
1308+
application/json:
1309+
examples:
1310+
indicesPutSettingRequestExample1:
1311+
$ref: "../../specification/indices/put_mapping/indicesPutMappingRequestExample1.yaml"
1312+
- target: "$.components['requestBodies']['indices.put_settings']"
1313+
description: "Add example for update index settings request"
1314+
update:
1315+
content:
1316+
application/json:
1317+
examples:
1318+
indicesPutSettingRequestExample1:
1319+
$ref: "../../specification/indices/put_settings/IndicesPutSettingsRequestExample1.yaml"
1320+
- target: "$.paths['/_resolve/index/{name}']['get']"
1321+
description: "Add examples for resolve index operation"
1322+
update:
1323+
responses:
1324+
200:
1325+
content:
1326+
application/json:
1327+
examples:
1328+
indicesResolveResponseExample1:
1329+
$ref: "../../specification/indices/resolve_index/indicesResolveResponseExample1.yaml"
1330+
- target: "$.components['requestBodies']['indices.rollover']"
1331+
description: "Add example for rollover index request"
1332+
update:
1333+
content:
1334+
application/json:
1335+
examples:
1336+
indicesRolloverRequestExample1:
1337+
$ref: "../../specification/indices/rollover/indicesRolloverRequestExample1.yaml"
1338+
- target: "$.components['responses']['indices.rollover#200']"
1339+
description: "Add example for rollover index response"
1340+
update:
1341+
content:
1342+
application/json:
1343+
examples:
1344+
indicesRolloverResponseExample1:
1345+
$ref: "../../specification/indices/rollover/indicesRolloverResponseExample1.yaml"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
summary: Create an index template.
2+
# method_request: PUT /_index_template/template_1
3+
# description: ''
4+
# type: request
5+
value:
6+
"{\n \"index_patterns\" : [\"template*\"],\n \"priority\" : 1,\n \"template\"\
7+
: {\n \"settings\" : {\n \"number_of_shards\" : 2\n }\n }\n}"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
summary: Create or update the mapping of an index.
2+
# method_request: PUT /my-index-000001/_mapping
3+
# description: ''
4+
# type: request
5+
value:
6+
"{\n \"properties\": {\n \"email\": {\n \"type\": \"keyword\"\n \
7+
\ }\n }\n}"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
summary: Change a dynamic index setting in real time.
2+
# method_request: PUT /my-index-000001/_settings
3+
# description: ''
4+
# type: request
5+
value: "{\n \"index\" : {\n \"number_of_replicas\" : 2\n }\n}"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
summary: Create or update an index template.
2+
# method_request: PUT _template/template_1
3+
# description: ''
4+
# type: request
5+
value:
6+
index_patterns:
7+
- 'te*'
8+
- 'bar*'
9+
settings:
10+
number_of_shards: 1
11+
mappings:
12+
_source:
13+
enabled: false
14+
properties:
15+
host_name:
16+
type: keyword
17+
created_at:
18+
type: date
19+
format: 'EEE MMM dd HH:mm:ss Z yyyy'
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
summary: A successful response for retrieving information about ongoing and completed shard recoveries for an index.
2+
# description: ''
3+
# type: response
4+
response_code: 200
5+
value:
6+
"{\n \"index1\" : {\n \"shards\" : [ {\n \"id\" : 0,\n \"type\"\
7+
\ : \"SNAPSHOT\",\n \"stage\" : \"INDEX\",\n \"primary\" : true,\n \
8+
\ \"start_time\" : \"2014-02-24T12:15:59.716\",\n \"start_time_in_millis\"\
9+
: 1393244159716,\n \"stop_time\" : \"0s\",\n \"stop_time_in_millis\" :\
10+
\ 0,\n \"total_time\" : \"2.9m\",\n \"total_time_in_millis\" : 175576,\n\
11+
\ \"source\" : {\n \"repository\" : \"my_repository\",\n \"snapshot\"\
12+
\ : \"my_snapshot\",\n \"index\" : \"index1\",\n \"version\" : \"\
13+
{version}\",\n \"restoreUUID\": \"PDh1ZAOaRbiGIVtCvZOMww\"\n },\n \
14+
\ \"target\" : {\n \"id\" : \"ryqJ5lO5S4-lSFbGntkEkg\",\n \"host\"\
15+
\ : \"my.fqdn\",\n \"transport_address\" : \"my.fqdn\",\n \"ip\" :\
16+
\ \"10.0.1.7\",\n \"name\" : \"my_es_node\"\n },\n \"index\" :\
17+
\ {\n \"size\" : {\n \"total\" : \"75.4mb\",\n \"total_in_bytes\"\
18+
\ : 79063092,\n \"reused\" : \"0b\",\n \"reused_in_bytes\" : 0,\n\
19+
\ \"recovered\" : \"65.7mb\",\n \"recovered_in_bytes\" : 68891939,\n\
20+
\ \"recovered_from_snapshot\" : \"0b\",\n \"recovered_from_snapshot_in_bytes\"\
21+
\ : 0,\n \"percent\" : \"87.1%\"\n },\n \"files\" : {\n \
22+
\ \"total\" : 73,\n \"reused\" : 0,\n \"recovered\" :\
23+
\ 69,\n \"percent\" : \"94.5%\"\n },\n \"total_time\" : \"\
24+
0s\",\n \"total_time_in_millis\" : 0,\n \"source_throttle_time\" :\
25+
\ \"0s\",\n \"source_throttle_time_in_millis\" : 0,\n \"target_throttle_time\"\
26+
\ : \"0s\",\n \"target_throttle_time_in_millis\" : 0\n },\n \"\
27+
translog\" : {\n \"recovered\" : 0,\n \"total\" : 0,\n \"percent\"\
28+
\ : \"100.0%\",\n \"total_on_start\" : 0,\n \"total_time\" : \"0s\"\
29+
,\n \"total_time_in_millis\" : 0\n },\n \"verify_index\" : {\n\
30+
\ \"check_index_time\" : \"0s\",\n \"check_index_time_in_millis\"\
31+
\ : 0,\n \"total_time\" : \"0s\",\n \"total_time_in_millis\" : 0\n\
32+
\ }\n } ]\n }\n}"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
summary: A successful response for resolving a specified index expression to return information about each cluster.
2+
# description: ''
3+
# type: response
4+
response_code: 200
5+
value:
6+
"{\n \"(local)\": {\n \"connected\": true,\n \"skip_unavailable\": false,\n\
7+
\ \"matching_indices\": true,\n \"version\": {\n \"number\": \"8.13.0\"\
8+
,\n \"build_flavor\": \"default\",\n \"minimum_wire_compatibility_version\"\
9+
: \"7.17.0\",\n \"minimum_index_compatibility_version\": \"7.0.0\"\n }\n\
10+
\ },\n \"cluster_one\": {\n \"connected\": true,\n \"skip_unavailable\"\
11+
: true,\n \"matching_indices\": true,\n \"version\": {\n \"number\":\
12+
\ \"8.13.0\",\n \"build_flavor\": \"default\",\n \"minimum_wire_compatibility_version\"\
13+
: \"7.17.0\",\n \"minimum_index_compatibility_version\": \"7.0.0\"\n }\n\
14+
\ },\n \"cluster_two\": {\n \"connected\": true,\n \"skip_unavailable\"\
15+
: false,\n \"matching_indices\": true,\n \"version\": {\n \"number\"\
16+
: \"8.13.0\",\n \"build_flavor\": \"default\",\n \"minimum_wire_compatibility_version\"\
17+
: \"7.17.0\",\n \"minimum_index_compatibility_version\": \"7.0.0\"\n }\n\
18+
\ }\n}"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
summary: A successful response for resolving the specified name for an index.
2+
# description: ''
3+
# type: response
4+
response_code: 200
5+
value:
6+
"{\n \"indices\": [\n {\n \"name\": \"foo_closed\",\n \"attributes\"\
7+
: [\n \"closed\"\n ]\n },\n {\n \"name\": \"freeze-index\"\
8+
,\n \"aliases\": [\n \"f-alias\"\n ],\n \"attributes\": [\n\
9+
\ \"open\"\n ]\n },\n {\n \"name\": \"remoteCluster1:bar-01\"\
10+
,\n \"attributes\": [\n \"open\"\n ]\n }\n ],\n \"aliases\"\
11+
: [\n {\n \"name\": \"f-alias\",\n \"indices\": [\n \"freeze-index\"\
12+
,\n \"my-index-000001\"\n ]\n }\n ],\n \"data_streams\": [\n \
13+
\ {\n \"name\": \"foo\",\n \"backing_indices\": [\n \".ds-foo-2099.03.07-000001\"\
14+
\n ],\n \"timestamp_field\": \"@timestamp\"\n }\n ]\n}"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
summary: Create a new index for a data stream.
2+
# method_request: POST my-data-stream/_rollover
3+
# description: ''
4+
# type: request
5+
value:
6+
"{\n \"conditions\": {\n \"max_age\": \"7d\",\n \"max_docs\": 1000,\n\
7+
\ \"max_primary_shard_size\": \"50gb\",\n \"max_primary_shard_docs\": \"2000\"\
8+
\n }\n}"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
summary: A successful response for creating a new index for a data stream.
2+
# description: ''
3+
# type: response
4+
response_code: 200
5+
value:
6+
"{\n \"acknowledged\": true,\n \"shards_acknowledged\": true,\n \"old_index\"\
7+
: \".ds-my-data-stream-2099.05.06-000001\",\n \"new_index\": \".ds-my-data-stream-2099.05.07-000002\"\
8+
,\n \"rolled_over\": true,\n \"dry_run\": false,\n \"lazy\": false,\n \"conditions\"\
9+
: {\n \"[max_age: 7d]\": false,\n \"[max_docs: 1000]\": true,\n \"[max_primary_shard_size:\
10+
\ 50gb]\": false,\n \"[max_primary_shard_docs: 2000]\": false\n }\n}"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
summary: Shrink an existing index into a new index with fewer primary shards.
2+
# method_request: POST /my_source_index/_shrink/my_target_index
3+
# description: ''
4+
# type: request
5+
value:
6+
"{\n \"settings\": {\n \"index.routing.allocation.require._name\": null,\n\
7+
\ \"index.blocks.write\": null\n }\n}"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
summary: Split an existing index into a new index with more primary shards.
2+
# method_request: POST /my-index-000001/_split/split-my-index-000001
3+
# description: ''
4+
# type: request
5+
value: "{\n \"settings\": {\n \"index.number_of_shards\": 2\n }\n}"

0 commit comments

Comments
 (0)