Elasticsearch Enable Adaptive Replica Selection in OpenSearch

By Opster Team

Updated: Apr 9, 2023

| 1 min read

In addition to reading this guide, we recommend you run the Elasticsearch Health Check-Up. It will detect issues and improve your Elasticsearch performance by analyzing your shard sizes, threadpools, memory, snapshots, disk watermarks and more.

The Elasticsearch Check-Up is free and requires no installation.

Before you begin reading this guide, we recommend you try running the OpenSearch Error Check-Up which analyzes 2 JSON files to detect many configuration errors.

To easily resolve issues in your deployment and locate their root cause, try AutoOps for OpenSearch. It diagnoses problems by analyzing hundreds of metrics collected by a lightweight agent and offers guidance for resolving them.

Overview

Adaptive replica selection is a process intended to prevent a distressed OpenSearch node from delaying the response to queries, while reducing the search load on that node.

To understand how it works, imagine a situation where a single node is in distress. This could be because of hardware, network or configuration issues, but as a consequence the response time for shards on that node are much longer than the response time from the other nodes.

When an OpenSearch node receives a query, it needs to receive a response from all of the shards in all of the indices covered by that query so multiple nodes are usually involved in producing the response. Without adaptive replica selection, OpenSearch would check which replicas are available from all the nodes including the node in distress, and request responses for each shard from the other nodes based on a “round robin” approach. Using adaptive replica selection, OpenSearch will only request data from shards on a distressed node when there is no other alternative (i.e. when there are no other replicas), resulting in reduced load on distressed nodes, and shorter response times.

How to resolve it

By default, adaptive replica selection is enabled. You can enable it manually by running the following:

PUT /_cluster/settings
{
  "transient": {
    "cluster.routing.use_adaptive_replica_selection": true
  }
}

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?


Analyze your cluster & get personalized recommendations

Skip to content