From bfba77b9a500b624a397de15338a57115cff79c1 Mon Sep 17 00:00:00 2001 From: Liam Thompson Date: Wed, 11 Jun 2025 11:54:55 +0200 Subject: [PATCH 1/5] Add refresh interval examples from old API ref --- .../optimize-performance/indexing-speed.md | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/deploy-manage/production-guidance/optimize-performance/indexing-speed.md b/deploy-manage/production-guidance/optimize-performance/indexing-speed.md index 9b1cbf779a..a3a77670a9 100644 --- a/deploy-manage/production-guidance/optimize-performance/indexing-speed.md +++ b/deploy-manage/production-guidance/optimize-performance/indexing-speed.md @@ -46,6 +46,45 @@ This is the optimal configuration if you have no or very little search traffic ( 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. +### Disable refresh interval + +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. + +To disable the refresh interval, run the following request: + +```console +PUT /my-index-000001/_settings +{ + "index" : { + "refresh_interval" : "-1" + } +} +``` + +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. + +To restore the refresh interval, run the following request with your value: + +```console +PUT /my-index-000001/_settings +{ + "index" : { + "refresh_interval" : "5s" <1> + } +} +``` + +1. For {{serverless-full}} deployments, `refresh_interval` must be either `-1`, or equal to or greater than `5s` + +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:: + +```console +POST /my-index-000001/_forcemerge?max_num_segments=5 +``` + +::::{warning} +Force merge is an expensive operation. +:::: ## Disable replicas for initial loads [_disable_replicas_for_initial_loads] From 5c8f8f917b58b4f9712b05d3edb65d30e9a1922e Mon Sep 17 00:00:00 2001 From: Liam Thompson Date: Wed, 11 Jun 2025 11:59:58 +0200 Subject: [PATCH 2/5] restore test snippet comments --- .../optimize-performance/indexing-speed.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deploy-manage/production-guidance/optimize-performance/indexing-speed.md b/deploy-manage/production-guidance/optimize-performance/indexing-speed.md index a3a77670a9..ccdedc18bd 100644 --- a/deploy-manage/production-guidance/optimize-performance/indexing-speed.md +++ b/deploy-manage/production-guidance/optimize-performance/indexing-speed.md @@ -60,6 +60,7 @@ PUT /my-index-000001/_settings } } ``` +% TEST[setup:my_index] 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. @@ -73,6 +74,8 @@ PUT /my-index-000001/_settings } } ``` +% TEST[continued] + 1. For {{serverless-full}} deployments, `refresh_interval` must be either `-1`, or equal to or greater than `5s` @@ -81,6 +84,7 @@ When bulk indexing is complete, consider running a [force merge](https://www.ela ```console POST /my-index-000001/_forcemerge?max_num_segments=5 ``` +% TEST[continued] ::::{warning} Force merge is an expensive operation. From 9adcf9f99f596e09d9afb579ec64866855454f89 Mon Sep 17 00:00:00 2001 From: Liam Thompson Date: Wed, 11 Jun 2025 12:02:15 +0200 Subject: [PATCH 3/5] words are hard --- .../production-guidance/optimize-performance/indexing-speed.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy-manage/production-guidance/optimize-performance/indexing-speed.md b/deploy-manage/production-guidance/optimize-performance/indexing-speed.md index ccdedc18bd..c4841102ee 100644 --- a/deploy-manage/production-guidance/optimize-performance/indexing-speed.md +++ b/deploy-manage/production-guidance/optimize-performance/indexing-speed.md @@ -64,7 +64,7 @@ PUT /my-index-000001/_settings 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. -To restore the refresh interval, run the following request with your value: +To restore the refresh interval, run the following request with your desired value: ```console PUT /my-index-000001/_settings From c85ba6b1cece3b6543ba6e87ffdeecc8a850bd50 Mon Sep 17 00:00:00 2001 From: Liam Thompson Date: Wed, 11 Jun 2025 12:17:48 +0200 Subject: [PATCH 4/5] add update analyzers section to specify analyzer guide --- .../text-analysis/specify-an-analyzer.md | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/manage-data/data-store/text-analysis/specify-an-analyzer.md b/manage-data/data-store/text-analysis/specify-an-analyzer.md index 2b59ed7b60..2534a4ca77 100644 --- a/manage-data/data-store/text-analysis/specify-an-analyzer.md +++ b/manage-data/data-store/text-analysis/specify-an-analyzer.md @@ -122,7 +122,6 @@ GET my-index-000001/_search } ``` - ## Specify the search analyzer for a field [specify-search-field-analyzer] 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 } ``` +## Update analyzers on existing indices +```yaml {applies_to} +serverless: unavailable +``` + +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. +For example, the following commands add the `content` analyzer to the `my-index-000001` index: + +```console +POST /my-index-000001/_close +``` +% TEST[setup:my_index] + +```console +PUT /my-index-000001/_settings +{ + "analysis" : { + "analyzer":{ + "content":{ + "type":"custom", + "tokenizer":"whitespace" + } + } + } +} +``` +% TEST[continued] + +``` +POST /my-index-000001/_open +``` +% TEST[continued] + +::::{warning} +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. + +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). +:::: From 73517876b8ac81259e91ab0804fe5aad31465bd3 Mon Sep 17 00:00:00 2001 From: Liam Thompson Date: Wed, 11 Jun 2025 12:19:10 +0200 Subject: [PATCH 5/5] add console marker to request --- manage-data/data-store/text-analysis/specify-an-analyzer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manage-data/data-store/text-analysis/specify-an-analyzer.md b/manage-data/data-store/text-analysis/specify-an-analyzer.md index 2534a4ca77..111c2072e3 100644 --- a/manage-data/data-store/text-analysis/specify-an-analyzer.md +++ b/manage-data/data-store/text-analysis/specify-an-analyzer.md @@ -201,7 +201,7 @@ PUT /my-index-000001/_settings ``` % TEST[continued] -``` +```console POST /my-index-000001/_open ``` % TEST[continued]