Large query isolation can be configured to manage queries that have high memory usage or take too long to complete. This helps improve the stability of Elasticsearch clusters and prevent out-of-memory (OOM) exceptions.
As business grows, your Elasticsearch clusters may face mounting query pressure. Some complex queries may occupy excessive node memory, triggering frequent garbage collection or even OOM exceptions, which may compromise cluster performance and stability. Large query isolation enables effective management of memory-intensive, time-consuming query requests, ensuring cluster stability. Large query isolation includes the following:
Only Elasticsearch 7.6.2 and 7.10.2 support large query isolation, which is enabled by default. The global timeout is disabled by default for large query isolation. You can enable and configure it via an API when necessary. Any change takes effect immediately.
Log in to Kibana and go to the command execution page. Elasticsearch clusters support multiple access methods. This topic uses Kibana as an example to describe the operation procedures.
The left part of the console is the command input box, and the triangle icon in its upper-right corner is the execution button. The right part shows the execution result.
Large query isolation places large queries in an isolation pool, where they may be cancelled based on preset memory or duration thresholds. Large query isolation is enabled by default. You can modify this setting whenever necessary. Any change takes effect immediately.
PUT _cluster/settings{"persistent": {"search.isolator.enabled": true}}
Parameter | Type | Default Value | Description |
|---|---|---|---|
search.isolator.enabled | Boolean | true | Whether to enable large query isolation. When enabled, large queries are managed separately from other normal queries. The value can be:
|
PUT _cluster/settings{"persistent": {"search.isolator.memory.task.limit": "50MB","search.isolator.time.management": "10s"}}
Parameter | Type | Default Value | Description |
|---|---|---|---|
search.isolator.memory.task.limit | String | 50MB | Large query memory threshold: When a query requests more memory than specified by this threshold, it is placed into an isolation pool. Value format: number + unit
Minimum value: 0 (all queries are placed into the isolation pool) Maximum value: maximum node heap memory Lowering this value will cause more queries to be placed into the isolation pool, which will increase its memory usage. If you do lower this value, you should also increase the values of search.isolator.memory.pool.limit and search.isolator.count.limit, so that the isolation pool can hold more queries. This helps avoid triggering the circuit breaker mechanism due to resource exhaustion (for example, frequent query cancellation). |
search.isolator.time.management | String | 10s | Large query execution duration threshold: When a query has lasted longer than specified by this threshold, it is placed into an isolation pool. Value format: number + unit
Minimum value: 0 (all queries are placed into the isolation pool) Lowering this value will cause more queries to be placed into the isolation pool, which will increase its memory usage. If you do lower this value, you should also increase the values of search.isolator.memory.pool.limit and search.isolator.count.limit, so that the isolation pool can hold more queries. This helps avoid triggering the circuit breaker mechanism due to resource exhaustion (for example, frequent query cancellation). |
PUT _cluster/settings{"persistent": {"search.isolator.memory.pool.limit": "50%","search.isolator.count.limit": 1000,"search.isolator.memory.heap.limit": "90%"}}
Parameter | Type | Default Value | Description |
|---|---|---|---|
search.isolator.memory.pool.limit | String | 50% | Maximum memory usage of the isolation pool as a percentage of the maximum node heap memory. When the total memory usage of large queries in the isolation pool exceeds this limit, the system cancels one of the large queries in the isolation pool based on a predefined policy to free resources and prevent memory overflow. Value range: 0.0–100.0% If your cluster primarily handles large queries (high memory usage or long execution time), increase this value. Meanwhile, set search.isolator.memory.task.limit and search.isolator.time.management accordingly to control the number of queries placed into the isolation pool. |
search.isolator.count.limit | Integer | 1000 | Maximum number of large queries allowed in the isolation pool. When this limit is reached, no more queries can be added to the isolation pool, preventing resource exhaustion. Value range: 10–50000 If your cluster primarily handles large queries (high memory usage or long execution time), increase this value. Meanwhile, set search.isolator.memory.task.limit and search.isolator.time.management accordingly to control the number of queries placed into the isolation pool. |
search.isolator.memory.heap.limit | String | 90% | Node heap memory usage that triggers large query cancellation in the isolation pool. When this threshold is reached, the system cancels one of the large queries in the isolation pool based on a predefined policy to free resources and prevent memory overflow. Value range: 0.0–100.0% When indices.breaker.total.use_real_memory is enabled, this value must be lower than indices.breaker.total.limit. Otherwise, the native Elasticsearch circuit breaker will always be triggered first. For details, see Circuit breaker settings. If you anticipate traffic peaks or surges, you can lower this value to have the isolation pool's circuit breaker triggered earlier, thus preventing heap memory overload. |
PUT _cluster/settings{"persistent": {"search.isolator.strategy": "fair","search.isolator.strategy.ratio": "0.5%"}}
Parameter | Type | Default Value | Description |
|---|---|---|---|
search.isolator.strategy | String | fair | Policy for determining which query to cancel when query cancellation is triggered.
The large query isolation pool is checked every second until the heap memory is within a safe range. |
search.isolator.strategy.ratio | String | 1% | Fair policy threshold. This is the ratio of the memory usage difference between two candidate queries in the isolation pool to the maximum node heap memory.
This parameter is valid only when search.isolator.strategy is set to fair. Value range: 0.0–100.0% You are advised to use the default value. Adjust only if necessary and with caution. |
PUT _cluster/settings{"persistent": {"search.isolator.log.count": "100"}}
Parameter | Type | Default Value | Description |
|---|---|---|---|
search.isolator.log.count | Integer | 100 | The maximum number of cancelled query records retained in the large query isolation log. The large query isolation log records cancelled large queries for query performance analysis and optimization. Once this limit is exceeded, the system automatically deletes the oldest records to control the log's memory footprint. Value range: 0–5000 Setting this value to 0 disables the large query isolation log. |
You can use the following APIs to query log information about cancelled queries:
GET /_isolator_metrics
GET /_isolator_metrics/{nodeId}
GET /_isolator_metrics?detailed
GET /_isolator_metrics/{nodeId}?detailed
Parameter | Type | Default Value | Description |
|---|---|---|---|
node_id | String | N/A | Specifies one or more cluster nodes.
You can run the following command to obtain node IDs: |
Example response:
{"_nodes": {"total": 1,"successful": 1,"failed": 0},"cluster_name": "test","nodes": {"CTqrZFXWTzmLonSZyNMKkQ": {"name": "test-ess-esn-1-1","host": "172.16.101.116","total_cancel": 0, //Total number of cancelled queries"isolator_cancel": 0, //Number of queries cancelled because isolation pool thresholds were exceeded"out_of_time_cancel": 0 //Number of queries cancelled due to timeout}}}
When a global query timeout is configured, queries that exceed the specified duration are automatically cancelled, and the message "cancel cause by global time limit" is returned. This prevents long-running queries from consuming excessive resources. Global query timeout is disabled by default. You can modify this setting when necessary. Any change takes effect immediately.
Run the following command to enable and configure a global query timeout:
Parameter | Type | Default Value | Description |
|---|---|---|---|
search.isolator.time.enabled | Boolean | false | Whether to enable a global query timeout. When enabled, queries are automatically cancelled when they last longer than a predefined timeout. The value can be:
|
search.isolator.time.limit | String | 120s | The value of the global query timeout. Value format: number + unit
Minimum value: 0 (to cancel all queries) |