Skip to content

Commit

Permalink
Add x-codeSamples to check document API (#3594)
Browse files Browse the repository at this point in the history
(cherry picked from commit fcd7150)
  • Loading branch information
lcawl committed Jan 30, 2025
1 parent fac42ef commit ec57e47
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/overlays/elasticsearch-shared-overlays.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2381,3 +2381,13 @@ actions:
examples:
updateTransformResponseExample1:
$ref: "../../specification/transform/update_transform/examples/response/UpdateTransformResponseExample1.yaml"
## xCodeSamples
- target: "$.paths['/{index}/_doc/{id}']['head']"
description: "Add xCodeSamples for check document operation"
update:
x-codeSamples:
- $ref: "../../specification/_global/exists/examples/xCodeSamples/DocumentExistsConsoleExample1.yaml"
- $ref: "../../specification/_global/exists/examples/xCodeSamples/DocumentExistsCurlExample1.yaml"
- $ref: "../../specification/_global/exists/examples/xCodeSamples/DocumentExistsJavaScriptExample1.yaml"
- $ref: "../../specification/_global/exists/examples/xCodeSamples/DocumentExistsPythonExample1.yaml"
- $ref: "../../specification/_global/exists/examples/xCodeSamples/DocumentExistsRubyExample1.yaml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
lang: Console
# label:
source: |
HEAD my-index-000001/_doc/0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
lang: Curl
# label:
source: |
curl -I "localhost:9200/my-index-000001/_doc/0?pretty"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
lang: JavaScript
# label:
source: |
const response = await client.exists({
index: "my-index-000001",
id: 0,
});
console.log(response);
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
lang: Python
# label:
source: |
resp = client.exists(
index="my-index-000001",
id="0",
)
print(resp)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
lang: Ruby
# label:
source: |
response = client.exists(
index: 'my-index-000001',
id: 0
)
puts response

0 comments on commit ec57e47

Please sign in to comment.