Skip to content

File tree

2 files changed

+81
-1
lines changed

2 files changed

+81
-1
lines changed

deploy-manage/production-guidance/optimize-performance/indexing-speed.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,49 @@ This is the optimal configuration if you have no or very little search traffic (
4646

4747
On the other hand, if your index experiences regular search requests, this default behavior means that {{es}} will refresh your index every 1 second. If you can afford to increase the amount of time between when a document gets indexed and when it becomes visible, increasing the [`index.refresh_interval`](elasticsearch://reference/elasticsearch/index-settings/index-modules.md#index-refresh-interval-setting) to a larger value, e.g. `30s`, might help improve indexing speed.
4848

49+
### Disable refresh interval
50+
51+
To maximize indexing performance during large bulk operations, you can disable refreshing by setting the refresh interval to `-1`. This prevents {{es}} from performing any refreshes during the bulk indexing process.
52+
53+
To disable the refresh interval, run the following request:
54+
55+
```console
56+
PUT /my-index-000001/_settings
57+
{
58+
"index" : {
59+
"refresh_interval" : "-1"
60+
}
61+
}
62+
```
63+
% TEST[setup:my_index]
64+
65+
While refresh is disabled, your newly indexed documents will not be visible to search operations. Only re-enable refreshing after your bulk indexing is complete and you need the data to be searchable.
66+
67+
To restore the refresh interval, run the following request with your desired value:
68+
69+
```console
70+
PUT /my-index-000001/_settings
71+
{
72+
"index" : {
73+
"refresh_interval" : "5s" <1>
74+
}
75+
}
76+
```
77+
% TEST[continued]
78+
79+
80+
1. For {{serverless-full}} deployments, `refresh_interval` must be either `-1`, or equal to or greater than `5s`
81+
82+
When bulk indexing is complete, consider running a [force merge](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-forcemerge) {applies_to}`serverless: unavailable` to optimize search performance::
83+
84+
```console
85+
POST /my-index-000001/_forcemerge?max_num_segments=5
86+
```
87+
% TEST[continued]
88+
89+
::::{warning}
90+
Force merge is an expensive operation.
91+
::::
4992

5093
## Disable replicas for initial loads [_disable_replicas_for_initial_loads]
5194

manage-data/data-store/text-analysis/specify-an-analyzer.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ GET my-index-000001/_search
122122
}
123123
```
124124

125-
126125
## Specify the search analyzer for a field [specify-search-field-analyzer]
127126

128127
When mapping an index, you can use the [`search_analyzer`](elasticsearch://reference/elasticsearch/mapping-reference/analyzer.md) mapping parameter to specify a search analyzer for each `text` field.
@@ -173,4 +172,42 @@ PUT my-index-000001
173172
}
174173
```
175174

175+
## Update analyzers on existing indices
176+
```yaml {applies_to}
177+
serverless: unavailable
178+
```
179+
180+
You can only define new analyzers on closed indices. To add an analyzer, you must close the index, define the analyzer, and reopen the index.
176181
182+
For example, the following commands add the `content` analyzer to the `my-index-000001` index:
183+
184+
```console
185+
POST /my-index-000001/_close
186+
```
187+
% TEST[setup:my_index]
188+
189+
```console
190+
PUT /my-index-000001/_settings
191+
{
192+
"analysis" : {
193+
"analyzer":{
194+
"content":{
195+
"type":"custom",
196+
"tokenizer":"whitespace"
197+
}
198+
}
199+
}
200+
}
201+
```
202+
% TEST[continued]
203+
204+
```console
205+
POST /my-index-000001/_open
206+
```
207+
% TEST[continued]
208+
209+
::::{warning}
210+
You cannot close the write index of a data stream. To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the [index template](/manage-data/data-store/data-streams/set-up-data-stream.md#create-index-template) used by the stream. Then [roll over the data stream](/manage-data/data-store/data-streams/use-data-stream.md#manually-roll-over-a-data-stream) to apply the new analyzer to the stream's write index and future backing indices. This affects searches and any new data added to the stream after the rollover. However, it does not affect the data stream's backing indices or their existing data.
211+
212+
To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. See [Use reindex to change mappings or settings](../data-streams/modify-data-stream.md#data-streams-use-reindex-to-change-mappings-settings).
213+
::::

0 commit comments

Comments
 (0)