Skip to content

Commit 470590b

Browse files
szabostevelcawl
andauthored
Adds index API requests and responses - part 1 (#2979)
Co-authored-by: lcawl <[email protected]>
1 parent 0e35843 commit 470590b

17 files changed

+261
-4
lines changed

docs/overlays/elasticsearch-openapi-overlays.yaml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,41 @@ actions:
226226
application/json:
227227
examples:
228228
removePolicyResponseExample1:
229-
$ref: "../../specification/ilm/remove_policy/RemovePolicyResponseExample1.json"
229+
$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"
266+

docs/overlays/elasticsearch-shared-overlays.yaml

Lines changed: 88 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ actions:
302302
content:
303303
application/json:
304304
examples:
305-
asyncSearchSubmitResponseExample1:
305+
asyncSearchSubmitRequestExample1:
306306
$ref: "../../specification/async_search/submit/AsyncSearchSubmitRequestExample1.json"
307307
- target: "$.components['responses']['async_search.submit#200']"
308308
description: "Add example for asynch search submit response"
@@ -338,7 +338,7 @@ actions:
338338
examples:
339339
previewTransformRequestExample1:
340340
$ref: "../../specification/transform/preview_transform/PreviewTransformRequestExample1.json"
341-
- target: "$.components['reponses']['transform.preview_transform#200']"
341+
- target: "$.components['responses']['transform.preview_transform#200']"
342342
description: "Add examples for preview transform operation"
343343
update:
344344
content:
@@ -406,4 +406,89 @@ actions:
406406
application/json:
407407
examples:
408408
graphExploreRequestExample1:
409-
$ref: "../../specification/graph/explore/graphExploreRequestExample1.json"
409+
$ref: "../../specification/graph/explore/graphExploreRequestExample1.json"
410+
- target: "$.paths['/{index}/_block/{block}']['put']"
411+
description: "Add examples for add index block operation"
412+
update:
413+
responses:
414+
200:
415+
content:
416+
application/json:
417+
examples:
418+
indicesAddBlockResponseExample1:
419+
$ref: "../../specification/indices/add_block/IndicesAddBlockResponseExample1.yaml"
420+
- target: "$.components['requestBodies']['indices.analyze']"
421+
description: "Add example for analyze API request"
422+
update:
423+
content:
424+
application/json:
425+
examples:
426+
indicesAnalyzeRequestExample1:
427+
$ref: "../../specification/indices/analyze/indicesAnalyzeRequestExample1.yaml"
428+
- target: "$.paths['/{index}']['put']"
429+
description: "Add examples for create index request"
430+
update:
431+
requestBody:
432+
content:
433+
application/json:
434+
examples:
435+
indicesCreateRequestExample1:
436+
$ref: "../../specification/indices/create/indicesCreateRequestExample1.yaml"
437+
indicesCreateRequestExample2:
438+
$ref: "../../specification/indices/create/indicesCreateRequestExample2.yaml"
439+
- target: "$.paths['/_data_stream/{name}/_lifecycle']['delete']"
440+
description: "Add example for delete data stream lifecycle response"
441+
update:
442+
responses:
443+
200:
444+
content:
445+
application/json:
446+
examples:
447+
indicesDeleteDataLifecycleResponseExample1:
448+
$ref: "../../specification/indices/delete_data_lifecycle/IndicesDeleteDataLifecycleResponseExample1.yaml"
449+
- target: "$.paths['/_data_stream/{name}/_lifecycle']['get']"
450+
description: "Add example for get data stream lifecycle response"
451+
update:
452+
responses:
453+
200:
454+
content:
455+
application/json:
456+
examples:
457+
indicesGetDataLifecycleResponseExample1:
458+
$ref: "../../specification/indices/get_data_lifecycle/IndicesGetDataLifecycleResponseExample1.yaml"
459+
- target: "$.components['responses']['indices.get_data_stream#200']"
460+
description: "Add example for get data stream response"
461+
update:
462+
content:
463+
application/json:
464+
examples:
465+
indicesGetDataStreamResponseExample:
466+
$ref: "../../specification/indices/get_data_stream/indicesGetDataStreamResponseExample1.yaml"
467+
- target: "$.paths['/_data_stream/{name}/_lifecycle']['put']"
468+
description: "Add examples update data stream lifecycle request and response"
469+
update:
470+
requestBody:
471+
content:
472+
application/json:
473+
examples:
474+
indicesPutDataLifecycleRequestExample1:
475+
$ref: "../../specification/indices/put_data_lifecycle/IndicesPutDataLifecycleRequestExample1.yaml"
476+
indicesPutLifecycleRequestExample2:
477+
$ref: "../../specification/indices/put_data_lifecycle/IndicesPutDataLifecycleRequestExample2.yaml"
478+
responses:
479+
200:
480+
content:
481+
application/json:
482+
examples:
483+
indicesPutDataLifecycleResponseExample1:
484+
$ref: "../../specification/indices/put_data_lifecycle/IndicesPutDataLifecycleResponseExample1.yaml"
485+
- target: "$.paths['/{index}/_lifecycle/explain']['get']"
486+
description: "Add example for explain data stream lifecycle response"
487+
update:
488+
responses:
489+
200:
490+
content:
491+
application/json:
492+
examples:
493+
indicesExplainDataLifecycleResponseExample:
494+
$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)