Skip to content

Commit 260a527

Browse files
authored
[8.x] Adds index API requests and responses - part 1. (#2988)
1 parent 69e05a9 commit 260a527

17 files changed

+259
-3
lines changed

docs/overlays/elasticsearch-openapi-overlays.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,39 @@ actions:
227227
examples:
228228
removePolicyResponseExample1:
229229
$ref: "../../specification/ilm/remove_policy/RemovePolicyResponseExample1.json"
230+
- target: "$.components['requestBodies']['indices.clone']"
231+
description: "Add examples for clone index request"
232+
update:
233+
content:
234+
application/json:
235+
examples:
236+
indicesCloneRequestExample1:
237+
$ref: "../../specification/indices/clone/indicesCloneRequestExample1.yaml"
238+
- target: "$.paths['/{index}/_close']['post']"
239+
description: "Add examples for close index response"
240+
update:
241+
responses:
242+
200:
243+
content:
244+
application/json:
245+
examples:
246+
indicesCloseResponseExample1:
247+
$ref: "../../specification/indices/close/indicesCloseResponseExample1.yaml"
248+
- target: "$.components['responses']['indices.data_streams_stats#200']"
249+
description: "Add example for data stream stats response"
250+
update:
251+
content:
252+
application/json:
253+
examples:
254+
indicesDataStreamStatsResponseExample1:
255+
$ref: "../../specification/indices/data_streams_stats/indicesDataStreamStatsResponseExample1.yaml"
256+
- target: "$.paths['/{index}/_open']['post']"
257+
description: "Add examples for open index response"
258+
update:
259+
responses:
260+
200:
261+
content:
262+
application/json:
263+
examples:
264+
indicesOpenResponseExample1:
265+
$ref: "../../specification/indices/open/indicesOpenResponseExample1.yaml"

docs/overlays/elasticsearch-shared-overlays.yaml

Lines changed: 88 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ actions:
320320
content:
321321
application/json:
322322
examples:
323-
asyncSearchSubmitResponseExample1:
323+
asyncSearchSubmitRequestExample1:
324324
$ref: "../../specification/async_search/submit/AsyncSearchSubmitRequestExample1.json"
325325
- target: "$.components['responses']['async_search.submit#200']"
326326
description: "Add example for asynch search submit response"
@@ -356,7 +356,7 @@ actions:
356356
examples:
357357
previewTransformRequestExample1:
358358
$ref: "../../specification/transform/preview_transform/PreviewTransformRequestExample1.json"
359-
- target: "$.components['reponses']['transform.preview_transform#200']"
359+
- target: "$.components['responses']['transform.preview_transform#200']"
360360
description: "Add examples for preview transform operation"
361361
update:
362362
content:
@@ -424,4 +424,89 @@ actions:
424424
application/json:
425425
examples:
426426
graphExploreRequestExample1:
427-
$ref: "../../specification/graph/explore/graphExploreRequestExample1.json"
427+
$ref: "../../specification/graph/explore/graphExploreRequestExample1.json"
428+
- target: "$.paths['/{index}/_block/{block}']['put']"
429+
description: "Add examples for add index block operation"
430+
update:
431+
responses:
432+
200:
433+
content:
434+
application/json:
435+
examples:
436+
indicesAddBlockResponseExample1:
437+
$ref: "../../specification/indices/add_block/IndicesAddBlockResponseExample1.yaml"
438+
- target: "$.components['requestBodies']['indices.analyze']"
439+
description: "Add example for analyze API request"
440+
update:
441+
content:
442+
application/json:
443+
examples:
444+
indicesAnalyzeRequestExample1:
445+
$ref: "../../specification/indices/analyze/indicesAnalyzeRequestExample1.yaml"
446+
- target: "$.paths['/{index}']['put']"
447+
description: "Add examples for create index request"
448+
update:
449+
requestBody:
450+
content:
451+
application/json:
452+
examples:
453+
indicesCreateRequestExample1:
454+
$ref: "../../specification/indices/create/indicesCreateRequestExample1.yaml"
455+
indicesCreateRequestExample2:
456+
$ref: "../../specification/indices/create/indicesCreateRequestExample2.yaml"
457+
- target: "$.paths['/_data_stream/{name}/_lifecycle']['delete']"
458+
description: "Add example for delete data stream lifecycle response"
459+
update:
460+
responses:
461+
200:
462+
content:
463+
application/json:
464+
examples:
465+
indicesDeleteDataLifecycleResponseExample1:
466+
$ref: "../../specification/indices/delete_data_lifecycle/IndicesDeleteDataLifecycleResponseExample1.yaml"
467+
- target: "$.paths['/_data_stream/{name}/_lifecycle']['get']"
468+
description: "Add example for get data stream lifecycle response"
469+
update:
470+
responses:
471+
200:
472+
content:
473+
application/json:
474+
examples:
475+
indicesGetDataLifecycleResponseExample1:
476+
$ref: "../../specification/indices/get_data_lifecycle/IndicesGetDataLifecycleResponseExample1.yaml"
477+
- target: "$.components['responses']['indices.get_data_stream#200']"
478+
description: "Add example for get data stream response"
479+
update:
480+
content:
481+
application/json:
482+
examples:
483+
indicesGetDataStreamResponseExample:
484+
$ref: "../../specification/indices/get_data_stream/indicesGetDataStreamResponseExample1.yaml"
485+
- target: "$.paths['/_data_stream/{name}/_lifecycle']['put']"
486+
description: "Add examples update data stream lifecycle request and response"
487+
update:
488+
requestBody:
489+
content:
490+
application/json:
491+
examples:
492+
indicesPutDataLifecycleRequestExample1:
493+
$ref: "../../specification/indices/put_data_lifecycle/IndicesPutDataLifecycleRequestExample1.yaml"
494+
indicesPutLifecycleRequestExample2:
495+
$ref: "../../specification/indices/put_data_lifecycle/IndicesPutDataLifecycleRequestExample2.yaml"
496+
responses:
497+
200:
498+
content:
499+
application/json:
500+
examples:
501+
indicesPutDataLifecycleResponseExample1:
502+
$ref: "../../specification/indices/put_data_lifecycle/IndicesPutDataLifecycleResponseExample1.yaml"
503+
- target: "$.paths['/{index}/_lifecycle/explain']['get']"
504+
description: "Add example for explain data stream lifecycle response"
505+
update:
506+
responses:
507+
200:
508+
content:
509+
application/json:
510+
examples:
511+
indicesExplainDataLifecycleResponseExample:
512+
$ref: "../../specification/indices/explain_data_lifecycle/IndicesExplainDataLifecycleResponseExample1.yaml"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# summary: ''
2+
description: 'A successful response for adding an index block to an index.'
3+
# type: response
4+
# response_code: 200
5+
value:
6+
"{\n \"acknowledged\" : true,\n \"shards_acknowledged\" : true,\n \"indices\"\
7+
\ : [ {\n \"name\" : \"my-index-000001\",\n \"blocked\" : true\n } ]\n}"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
summary: Perform analysis on a text string and returns the resulting tokens.
2+
method_request: GET /_analyze
3+
# description: ''
4+
# type: request
5+
value: "{\n \"analyzer\" : \"standard\",\n \"text\" : \"Quick Brown Foxes!\"\n}"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
summary: Clone an existing index.
2+
# method_request: POST /my_source_index/_clone/my_target_index
3+
description: >
4+
Clone `my_source_index` into a new index called `my_target_index` with `POST /my_source_index/_clone/my_target_index`. The API accepts `settings` and `aliases` parameters for the target index.
5+
# type: request
6+
value:
7+
"{\n \"settings\": {\n \"index.number_of_shards\": 5\n },\n \"aliases\"\
8+
: {\n \"my_search_indices\": {}\n }\n}"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# summary: ''
2+
description: A successful response for closing an index.
3+
# type: response
4+
# response_code: 200
5+
value:
6+
"{\n \"acknowledged\": true,\n \"shards_acknowledged\": true,\n \"indices\"\
7+
: {\n \"my-index-000001\": {\n \"closed\": true\n }\n }\n}"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
summary: Creates an index.
2+
# method_request: PUT /my-index-000001
3+
description: This request specifies the `number_of_shards` and `number_of_replicas`.
4+
# type: request
5+
value:
6+
"{\n \"settings\": {\n \"number_of_shards\": 3,\n \"number_of_replicas\"\
7+
: 2\n }\n}"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
summary: Creates an index with mapping.
2+
# method_request: PUT /test
3+
description: You can provide mapping definitions in the create index API requests.
4+
# type: request
5+
value:
6+
"{\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"mappings\": {\n\
7+
\ \"properties\": {\n \"field1\": { \"type\": \"text\" }\n }\n }\n}"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# summary: ''
2+
description: A successful response for retrieving statistics for a data stream.
3+
# type: response
4+
# response_code: 200
5+
value:
6+
"{\n \"_shards\": {\n \"total\": 10,\n \"successful\": 5,\n \"failed\"\
7+
: 0\n },\n \"data_stream_count\": 2,\n \"backing_indices\": 5,\n \"total_store_size\"\
8+
: \"7kb\",\n \"total_store_size_bytes\": 7268,\n \"data_streams\": [\n {\n\
9+
\ \"data_stream\": \"my-data-stream\",\n \"backing_indices\": 3,\n \
10+
\ \"store_size\": \"3.7kb\",\n \"store_size_bytes\": 3772,\n \"maximum_timestamp\"\
11+
: 1607512028000\n },\n {\n \"data_stream\": \"my-data-stream-two\",\n\
12+
\ \"backing_indices\": 2,\n \"store_size\": \"3.4kb\",\n \"store_size_bytes\"\
13+
: 3496,\n \"maximum_timestamp\": 1607425567000\n }\n ]\n}"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# summary: ''
2+
description: A successful response for deleting a data stream lifecycle.
3+
# type: response
4+
# response_code: 200
5+
value: "{\n \"acknowledged\": true\n}"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# summary: ''
2+
description: A successful response for retrieving data stream lifecycle status for a data stream backing index.
3+
# type: response
4+
# response_code: 200
5+
value:
6+
"{\n \"indices\": {\n \".ds-metrics-2023.03.22-000001\": {\n \"index\"\
7+
\ : \".ds-metrics-2023.03.22-000001\",\n \"managed_by_lifecycle\" : true,\n\
8+
\ \"index_creation_date_millis\" : 1679475563571,\n \"time_since_index_creation\"\
9+
\ : \"843ms\",\n \"rollover_date_millis\" : 1679475564293,\n \"time_since_rollover\"\
10+
\ : \"121ms\",\n \"lifecycle\" : { },\n \"generation_time\" : \"121ms\"\
11+
\n }\n}"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# summary:
2+
description: A successful response of getting the lifecycle of a set of data streams.
3+
# type: response
4+
# response_code: 200
5+
value:
6+
"{\n \"data_streams\": [\n {\n \"name\": \"my-data-stream-1\",\n \
7+
\ \"lifecycle\": {\n \"enabled\": true,\n \"data_retention\":\
8+
\ \"7d\"\n }\n },\n {\n \"name\": \"my-data-stream-2\",\n \"\
9+
lifecycle\": {\n \"enabled\": true,\n \"data_retention\": \"7d\"\n\
10+
\ }\n }\n ]\n}"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# summary:
2+
description: A successful response for retrieving information about a data stream.
3+
# type: response
4+
# response_code: 200
5+
value:
6+
"{\n \"data_streams\": [\n {\n \"name\": \"my-data-stream\",\n \
7+
\ \"timestamp_field\": {\n \"name\": \"@timestamp\"\n },\n \"\
8+
indices\": [\n {\n \"index_name\": \".ds-my-data-stream-2099.03.07-000001\"\
9+
,\n \"index_uuid\": \"xCEhwsp8Tey0-FLNFYVwSg\",\n \"prefer_ilm\"\
10+
: true,\n \"ilm_policy\": \"my-lifecycle-policy\",\n \"managed_by\"\
11+
: \"Index Lifecycle Management\"\n },\n {\n \"index_name\"\
12+
: \".ds-my-data-stream-2099.03.08-000002\",\n \"index_uuid\": \"PA_JquKGSiKcAKBA8DJ5gw\"\
13+
,\n \"prefer_ilm\": true,\n \"ilm_policy\": \"my-lifecycle-policy\"\
14+
,\n \"managed_by\": \"Index Lifecycle Management\"\n }\n ],\n\
15+
\ \"generation\": 2,\n \"_meta\": {\n \"my-meta-field\": \"foo\"\
16+
\n },\n \"status\": \"GREEN\",\n \"next_generation_managed_by\":\
17+
\ \"Index Lifecycle Management\",\n \"prefer_ilm\": true,\n \"template\"\
18+
: \"my-index-template\",\n \"ilm_policy\": \"my-lifecycle-policy\",\n \
19+
\ \"hidden\": false,\n \"system\": false,\n \"allow_custom_routing\":\
20+
\ false,\n \"replicated\": false,\n \"rollover_on_write\": false\n \
21+
\ },\n {\n \"name\": \"my-data-stream-two\",\n \"timestamp_field\"\
22+
: {\n \"name\": \"@timestamp\"\n },\n \"indices\": [\n {\n\
23+
\ \"index_name\": \".ds-my-data-stream-two-2099.03.08-000001\",\n \
24+
\ \"index_uuid\": \"3liBu2SYS5axasRt6fUIpA\",\n \"prefer_ilm\": true,\n\
25+
\ \"ilm_policy\": \"my-lifecycle-policy\",\n \"managed_by\": \"\
26+
Index Lifecycle Management\"\n }\n ],\n \"generation\": 1,\n \
27+
\ \"_meta\": {\n \"my-meta-field\": \"foo\"\n },\n \"status\"\
28+
: \"YELLOW\",\n \"next_generation_managed_by\": \"Index Lifecycle Management\"\
29+
,\n \"prefer_ilm\": true,\n \"template\": \"my-index-template\",\n \
30+
\ \"ilm_policy\": \"my-lifecycle-policy\",\n \"hidden\": false,\n \"\
31+
system\": false,\n \"allow_custom_routing\": false,\n \"replicated\":\
32+
\ false,\n \"rollover_on_write\": false\n }\n ]\n}"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# summary:
2+
description: A successful response for opening an index.
3+
# type: response
4+
# response_code: 200
5+
value: "{\n \"acknowledged\" : true,\n \"shards_acknowledged\" : true\n}"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
summary: Set the data stream lifecycle retention
2+
# method_request: PUT _data_stream/my-data-stream/_lifecycle
3+
# description: Sets the lifecycle of a data stream.
4+
# type: request
5+
value: "{\n \"data_retention\": \"7d\"\n}"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
summary: Set the data stream lifecycle downsampling
2+
# method_request: PUT _data_stream/my-weather-sensor-data-stream/_lifecycle
3+
description: This example configures two downsampling rounds.
4+
# type: request
5+
value:
6+
"{\n \"downsampling\": [\n {\n \"after\": \"1d\",\n \"\
7+
fixed_interval\": \"10m\"\n },\n {\n \"after\": \"7d\",\n \
8+
\ \"fixed_interval\": \"1d\"\n }\n ]\n}"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# summary:
2+
description: A successful response for configuring a data stream lifecycle.
3+
# type: response
4+
# response_code: 200
5+
value: "{\n \"acknowledged\": true\n}"

0 commit comments

Comments
 (0)