Skip to content

Commit 04f612b

Browse files
Fixed a badly formatted example (#4851)
* Fixed a badly formatted example * Update indicesPutSettingsRequestExample3.yaml * Update specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample3.yaml --------- Co-authored-by: lcawl <lcawley@elastic.co>
1 parent 936699b commit 04f612b

File tree

7 files changed

+57
-63
lines changed

7 files changed

+57
-63
lines changed

output/openapi/elasticsearch-openapi.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/openapi/elasticsearch-serverless-openapi.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/schema.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/eql/search/examples/request/EqlSearchRequestExample2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ alternatives:
5151
]\\n [ process where stringContains(process.executable, \\\"regsvr32\\\") ]\\n \"}'
5252
\"$ELASTICSEARCH_URL/my-data-stream/_eql/search\""
5353
- language: Java
54-
code: |
54+
code: >
5555
client.eql().search(s -> s
5656
.index("my-data-stream")
5757
.query(" sequence by process.pid [ file where file.name == \"cmd.exe\" and process.pid != 2013 ][ process where stringContains(process.executable, \"regsvr32\") ] ")

specification/esql/query/examples/request/QueryRequestExample1.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ alternatives:
4949
library,remote-*:library\\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\\n | STATS MAX(page_count) BY year\\n |
5050
SORT year\\n | LIMIT 5\\n \",\"include_ccs_metadata\":true}' \"$ELASTICSEARCH_URL/_query\""
5151
- language: Java
52-
code: |
52+
code: >
5353
client.esql().query(q -> q
5454
.includeCcsMetadata(true)
5555
.query(" FROM library,remote-*:library | EVAL year = DATE_TRUNC(1 YEARS, release_date) | STATS MAX(page_count) BY year | SORT year | LIMIT 5 ")
Lines changed: 42 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,54 @@
11
summary: Update index analysis
2-
method_request: POST /my-index-000001/_close
3-
description: To add an analyzer, you must close the index, define the analyzer, then reopen the index.
2+
method_request: PUT /my-index-000001/_settings
3+
description:
4+
To add an analyzer, you must close the index (`POST /my-index-000001/_close`), define the analyzer, then reopen the
5+
index (`POST /my-index-000001/_open`).
46
# type: request
5-
value: "{
6-
7-
\ \"analysis\" : {
8-
9-
\ \"analyzer\":{
10-
11-
\ \"content\":{
12-
13-
\ \"type\":\"custom\",
14-
15-
\ \"tokenizer\":\"whitespace\"
16-
17-
\ }
18-
19-
\ }
20-
21-
\ }
22-
7+
value: |-
8+
{
9+
"analysis": {
10+
"analyzer": {
11+
"content": {
12+
"type": "custom",
13+
"tokenizer": "whitespace"
14+
}
15+
}
16+
}
2317
}
24-
25-
26-
POST /my-index-000001/_open"
2718
alternatives:
2819
- language: Python
2920
code: |-
30-
resp = client.indices.close(
31-
index="my-index-000001",
32-
)
33-
34-
resp1 = client.indices.open(
21+
resp = client.indices.put_settings(
3522
index="my-index-000001",
23+
settings={
24+
"analysis": {
25+
"analyzer": {
26+
"content": {
27+
"type": "custom",
28+
"tokenizer": "whitespace"
29+
}
30+
}
31+
}
32+
},
3633
)
3734
- language: JavaScript
3835
code: |-
39-
const response = await client.indices.close({
40-
index: "my-index-000001",
41-
});
42-
43-
const response1 = await client.indices.open({
36+
const response = await client.indices.putSettings({
4437
index: "my-index-000001",
38+
settings: {
39+
analysis: {
40+
analyzer: {
41+
content: {
42+
type: "custom",
43+
tokenizer: "whitespace",
44+
},
45+
},
46+
},
47+
},
4548
});
4649
- language: Ruby
4750
code: |-
48-
response = client.indices.close(
51+
response = client.indices.put_settings(
4952
index: "my-index-000001",
5053
body: {
5154
"analysis": {
@@ -58,13 +61,9 @@ alternatives:
5861
}
5962
}
6063
)
61-
62-
response1 = client.indices.open(
63-
index: "my-index-000001"
64-
)
6564
- language: PHP
6665
code: |-
67-
$resp = $client->indices()->close([
66+
$resp = $client->indices()->putSettings([
6867
"index" => "my-index-000001",
6968
"body" => [
7069
"analysis" => [
@@ -77,13 +76,8 @@ alternatives:
7776
],
7877
],
7978
]);
80-
81-
$resp1 = $client->indices()->open([
82-
"index" => "my-index-000001",
83-
]);
8479
- language: curl
85-
code: >-
86-
curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d
87-
'{"analysis":{"analyzer":{"content":{"type":"custom","tokenizer":"whitespace"}}}}' "$ELASTICSEARCH_URL/my-index-000001/_close"
88-
89-
curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_open"
80+
code:
81+
'curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d
82+
''{"analysis":{"analyzer":{"content":{"type":"custom","tokenizer":"whitespace"}}}}''
83+
"$ELASTICSEARCH_URL/my-index-000001/_settings"'

specification/ml/infer_trained_model/examples/request/MlInferTrainedModelExample1.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ alternatives:
5555
''{"docs":[{"text":"The fool doth think he is wise, but the wise man knows himself to be a fool."}]}''
5656
"$ELASTICSEARCH_URL/_ml/trained_models/lang_ident_model_1/_infer"'
5757
- language: Java
58-
code: |
58+
code: >
5959
client.ml().inferTrainedModel(i -> i
6060
.docs(Map.of("text", JsonData.fromJson("\"The fool doth think he is wise, but the wise man knows himself to be a fool.\"")))
6161
.modelId("lang_ident_model_1")

0 commit comments

Comments
 (0)