1
1
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`).
4
6
# 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
+ }
23
17
}
24
-
25
-
26
- POST /my-index-000001/_open"
27
18
alternatives :
28
19
- language : Python
29
20
code : |-
30
- resp = client.indices.close(
31
- index="my-index-000001",
32
- )
33
-
34
- resp1 = client.indices.open(
21
+ resp = client.indices.put_settings(
35
22
index="my-index-000001",
23
+ settings={
24
+ "analysis": {
25
+ "analyzer": {
26
+ "content": {
27
+ "type": "custom",
28
+ "tokenizer": "whitespace"
29
+ }
30
+ }
31
+ }
32
+ },
36
33
)
37
34
- language : JavaScript
38
35
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({
44
37
index: "my-index-000001",
38
+ settings: {
39
+ analysis: {
40
+ analyzer: {
41
+ content: {
42
+ type: "custom",
43
+ tokenizer: "whitespace",
44
+ },
45
+ },
46
+ },
47
+ },
45
48
});
46
49
- language : Ruby
47
50
code : |-
48
- response = client.indices.close (
51
+ response = client.indices.put_settings (
49
52
index: "my-index-000001",
50
53
body: {
51
54
"analysis": {
@@ -58,13 +61,9 @@ alternatives:
58
61
}
59
62
}
60
63
)
61
-
62
- response1 = client.indices.open(
63
- index: "my-index-000001"
64
- )
65
64
- language : PHP
66
65
code : |-
67
- $resp = $client->indices()->close ([
66
+ $resp = $client->indices()->putSettings ([
68
67
"index" => "my-index-000001",
69
68
"body" => [
70
69
"analysis" => [
@@ -77,13 +76,8 @@ alternatives:
77
76
],
78
77
],
79
78
]);
80
-
81
- $resp1 = $client->indices()->open([
82
- "index" => "my-index-000001",
83
- ]);
84
79
- 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"'
0 commit comments