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}"

0 commit comments

Comments
 (0)