Skip to content

Commit 9a94e90

Browse files
authored
Add x-codeSamples to check document API (#3594) (#3664)
(cherry picked from commit fcd7150)
1 parent fac42ef commit 9a94e90

File tree

6 files changed

+42
-0
lines changed

6 files changed

+42
-0
lines changed

docs/overlays/elasticsearch-shared-overlays.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,3 +2381,13 @@ actions:
23812381
examples:
23822382
updateTransformResponseExample1:
23832383
$ref: "../../specification/transform/update_transform/examples/response/UpdateTransformResponseExample1.yaml"
2384+
## xCodeSamples
2385+
- target: "$.paths['/{index}/_doc/{id}']['head']"
2386+
description: "Add xCodeSamples for check document operation"
2387+
update:
2388+
x-codeSamples:
2389+
- $ref: "../../specification/_global/exists/examples/xCodeSamples/DocumentExistsConsoleExample1.yaml"
2390+
- $ref: "../../specification/_global/exists/examples/xCodeSamples/DocumentExistsCurlExample1.yaml"
2391+
- $ref: "../../specification/_global/exists/examples/xCodeSamples/DocumentExistsJavaScriptExample1.yaml"
2392+
- $ref: "../../specification/_global/exists/examples/xCodeSamples/DocumentExistsPythonExample1.yaml"
2393+
- $ref: "../../specification/_global/exists/examples/xCodeSamples/DocumentExistsRubyExample1.yaml"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
lang: Console
2+
# label:
3+
source: |
4+
HEAD my-index-000001/_doc/0
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
lang: Curl
2+
# label:
3+
source: |
4+
curl -I "localhost:9200/my-index-000001/_doc/0?pretty"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
lang: JavaScript
2+
# label:
3+
source: |
4+
const response = await client.exists({
5+
index: "my-index-000001",
6+
id: 0,
7+
});
8+
console.log(response);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
lang: Python
2+
# label:
3+
source: |
4+
resp = client.exists(
5+
index="my-index-000001",
6+
id="0",
7+
)
8+
print(resp)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
lang: Ruby
2+
# label:
3+
source: |
4+
response = client.exists(
5+
index: 'my-index-000001',
6+
id: 0
7+
)
8+
puts response

0 commit comments

Comments
 (0)