Skip to content

Commit fcd7150

Browse files
authored
Add x-codeSamples to check document API (#3594)
1 parent abca59a commit fcd7150

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
@@ -2169,3 +2169,13 @@ actions:
21692169
examples:
21702170
updateTransformResponseExample1:
21712171
$ref: "../../specification/transform/update_transform/examples/response/UpdateTransformResponseExample1.yaml"
2172+
## xCodeSamples
2173+
- target: "$.paths['/{index}/_doc/{id}']['head']"
2174+
description: "Add xCodeSamples for check document operation"
2175+
update:
2176+
x-codeSamples:
2177+
- $ref: "../../specification/_global/exists/examples/xCodeSamples/DocumentExistsConsoleExample1.yaml"
2178+
- $ref: "../../specification/_global/exists/examples/xCodeSamples/DocumentExistsCurlExample1.yaml"
2179+
- $ref: "../../specification/_global/exists/examples/xCodeSamples/DocumentExistsJavaScriptExample1.yaml"
2180+
- $ref: "../../specification/_global/exists/examples/xCodeSamples/DocumentExistsPythonExample1.yaml"
2181+
- $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)