11summary : 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/_open`), define the analyzer, then reopen the
5+ index (`POST /my-index-000001/_open`).
46# type: request
57value : |-
6- PUT /my-index-000001/_settings
78 {
89 "analysis": {
910 "analyzer": {
@@ -14,15 +15,10 @@ value: |-
1415 }
1516 }
1617 }
17- POST /my-index-000001/_open
1818alternatives :
1919 - language : Python
2020 code : |-
21- resp = client.indices.close(
22- index="my-index-000001",
23- )
24-
25- resp1 = client.indices.put_settings(
21+ resp = client.indices.put_settings(
2622 index="my-index-000001",
2723 settings={
2824 "analysis": {
@@ -35,17 +31,9 @@ alternatives:
3531 }
3632 },
3733 )
38-
39- resp2 = client.indices.open(
40- index="my-index-000001",
41- )
4234 - language : JavaScript
4335 code : |-
44- const response = await client.indices.close({
45- index: "my-index-000001",
46- });
47-
48- const response1 = await client.indices.putSettings({
36+ const response = await client.indices.putSettings({
4937 index: "my-index-000001",
5038 settings: {
5139 analysis: {
@@ -58,17 +46,9 @@ alternatives:
5846 },
5947 },
6048 });
61-
62- const response2 = await client.indices.open({
63- index: "my-index-000001",
64- });
6549 - language : Ruby
6650 code : |-
67- response = client.indices.close(
68- index: "my-index-000001"
69- )
70-
71- response1 = client.indices.put_settings(
51+ response = client.indices.put_settings(
7252 index: "my-index-000001",
7353 body: {
7454 "analysis": {
@@ -81,17 +61,9 @@ alternatives:
8161 }
8262 }
8363 )
84-
85- response2 = client.indices.open(
86- index: "my-index-000001"
87- )
8864 - language : PHP
8965 code : |-
90- $resp = $client->indices()->close([
91- "index" => "my-index-000001",
92- ]);
93-
94- $resp1 = $client->indices()->putSettings([
66+ $resp = $client->indices()->putSettings([
9567 "index" => "my-index-000001",
9668 "body" => [
9769 "analysis" => [
@@ -104,16 +76,8 @@ alternatives:
10476 ],
10577 ],
10678 ]);
107-
108- $resp2 = $client->indices()->open([
109- "index" => "my-index-000001",
110- ]);
11179 - language : curl
112- code : >-
113- curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_close"
114-
115- curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d
116- '{"analysis":{"analyzer":{"content":{"type":"custom","tokenizer":"whitespace"}}}}'
117- "$ELASTICSEARCH_URL/my-index-000001/_settings"
118-
119- 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"'
0 commit comments