# What is timeout to write to replica shard

**URL:** https://discuss.elastic.co/t/what-is-timeout-to-write-to-replica-shard/173966
**Category:** Elasticsearch
**Created:** [March 26, 2019, 3:59pm UTC](https://discuss.elastic.co/t/what-is-timeout-to-write-to-replica-shard/173966 "2019-03-26T15:59:43Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![oraclept](https://avatars.discourse-cdn.com/v4/letter/o/ce73a5/32.png) [@oraclept](https://discuss.elastic.co/u/oraclept)
#### Post date: [March 26, 2019, 3:59pm UTC](https://discuss.elastic.co/t/what-is-timeout-to-write-to-replica-shard/173966/1 "2019-03-26T15:59:43Z")

</div>

What is the timeout for writing to replica shard ? If it is taking long time to write to replica can i specify value to timeout write on replica shard.

I am reading below link.

[https://www.elastic.co/guide/en/elasticsearch/guide/current/distrib-write.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/distrib-write.html)

Valid write consistency values : one, quorum , and all

Because of below exception index is turning to yellow and shard reallocation is happening.

```
2019-02-20T13:10:11,644][WARN][o.e.c.a.s.ShardStateAction] [SEIGWPP05ES03] [sample_index][3] received shard failed for shard id [[sample_index][3]], allocation id [OKXJ2CKNR8CKilqJZpVe4Q], primary term [1], message [failed to perform indices:data/write/bulk[s] on replica [sample_index][3], node[IiIb5vQNSj6GAxyv2LbWBQ], [R], s[STARTED], a[id=OKXJ2CKNR8CKilqJZpVe4Q]], failure [NodeNotConnectedException[[samplenode][172.18.72.120:9300] Node not connected]]
```

---

<div class="post-metadata">

### Author: ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)
#### Post date: [March 26, 2019, 4:57pm UTC](https://discuss.elastic.co/t/what-is-timeout-to-write-to-replica-shard/173966/2 "2019-03-26T16:57:36Z")

</div>

No, there is no timeout. The primary waits indefinitely for the replica to respond (or for the connection to be closed).

The `consistency` parameter mentioned in your link no longer exists.

---

<div class="post-metadata">

### Author: ![oraclept](https://avatars.discourse-cdn.com/v4/letter/o/ce73a5/32.png) [@oraclept](https://discuss.elastic.co/u/oraclept)
#### Post date: [March 26, 2019, 5:52pm UTC](https://discuss.elastic.co/t/what-is-timeout-to-write-to-replica-shard/173966/3 "2019-03-26T17:52:33Z")

</div>

@DavidTurner I really appreciate your reply.

We have 5 node 6.1 elastic cluster with index having 10 primary and 2 replica. Does it mean it has to write it to 2 shards before it sends ack?

How can I avoid index turning to yellow? or have it to disregard check on replica copy irrespective of it is written to replica or not.

```
failed to perform indices:data/write/bulk [s] on replica.

```

We are frequently getting above exception.

Connection timeout is it elastic parameter?

What is default ack to the application? Quorum ?

I checked in master document

[https://www.elastic.co/guide/en/elasticsearch/guide/master/distrib-write.html](https://www.elastic.co/guide/en/elasticsearch/guide/master/distrib-write.html)

---

<div class="post-metadata">

### Author: ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)
#### Post date: [March 26, 2019, 6:27pm UTC](https://discuss.elastic.co/t/what-is-timeout-to-write-to-replica-shard/173966/4 "2019-03-26T18:27:55Z")

</div>

> [@oraclept](#):
>
> We have 5 node 6.1 elastic cluster with index having 10 primary and 2 replica. Does it mean it has to write it to 2 shards before it sends ack?

No, each write goes to the primary and both replicas before acknowledgement, so that's 3 shard copies in total.

> [@oraclept](#):
>
> How can I avoid index turning to yellow? or have it to disregard check on replica copy irrespective of it is written to replica or not.

Elasticsearch guarantees to write every document to every in-sync shard copy before responding. This means that if it can't write to a shard copy it must mark that copy as out-of-sync, which will mean it becomes unassigned and therefore that the index health reports as yellow.

There is no way to disregard this check. It's very important.

> [@oraclept](#):
>
> We are frequently getting above exception.

There will be more information in the logs telling you why. If you need help interpreting the logs then please share more information here - stack traces and other messages from around the same time are all important.

> [@oraclept](#):
>
> I checked in master document

The guide to which you link was written about the 2.x series and is rather out of date. The [reference manual](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-replication.html) has fresher information.

---

<div class="post-metadata">

### Author: ![oraclept](https://avatars.discourse-cdn.com/v4/letter/o/ce73a5/32.png) [@oraclept](https://discuss.elastic.co/u/oraclept)
#### Post date: [March 26, 2019, 7:54pm UTC](https://discuss.elastic.co/t/what-is-timeout-to-write-to-replica-shard/173966/5 "2019-03-26T19:54:55Z")

</div>

Thanks @DavidTurner for valuable information.  
Below is stack trace. I see node not connected exceptions.  
I dont see any exception on disconnected node. should I increase node timeout value.

> ```
> > [2019-03-26T02:16:55,992][WARN][o.e.c.a.s.ShardStateAction] [sample_node_1] [sample_index][3] received shard failed for shard id [[sample_index][3]], allocation id [-HYXaiLbTRSUyFyRhTO6Dw], primary term [3], message [failed to perform indices:data/write/bulk[s] on replica [sample_index][3], node[IiIb5vQNSj6GAxyv2LbWBQ], [R], s[STARTED], a[id=-HYXaiLbTRSUyFyRhTO6Dw]], failure [NodeNotConnectedException[[sample_node_2][172.18.72.120:9300] Node not connected]]
> 
> ```

> ```
> org.elasticsearch.transport.NodeNotConnectedException: [sample_node_2][172.18.72.120:9300] Node not connected
> at org.elasticsearch.transport.TcpTransport.getConnection(TcpTransport.java:692) ~[elasticsearch-6.1.0.jar:6.1.0]
> at org.elasticsearch.transport.TcpTransport.getConnection(TcpTransport.java:122) ~[elasticsearch-6.1.0.jar:6.1.0]
> at org.elasticsearch.transport.TransportService.getConnection(TransportService.java:525) ~[elasticsearch-6.1.0.jar:6.1.0]
> at org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:501) ~[elasticsearch-6.1.0.jar:6.1.0]
> at org.elasticsearch.action.support.replication.TransportReplicationAction.sendReplicaRequest(TransportReplicationAction.java:1188) ~[elasticsearch-6.1.0.jar:6.1.0]
> at org.elasticsearch.action.support.replication.TransportReplicationAction$ReplicasProxy.performOn(TransportReplicationAction.java:1152) ~[elasticsearch-6.1.0.jar:6.1.0]
> at org.elasticsearch.action.support.replication.ReplicationOperation.performOnReplica(ReplicationOperation.java:171) ~[elasticsearch-6.1.0.jar:6.1.0]
> at org.elasticsearch.action.support.replication.ReplicationOperation.performOnReplicas(ReplicationOperation.java:155) ~[elasticsearch-6.1.0.jar:6.1.0]
> at org.elasticsearch.action.support.replication.ReplicationOperation.execute(ReplicationOperation.java:122) ~[elasticsearch-6.1.0.jar:6.1.0]
> 
> ```

---

<div class="post-metadata">

### Author: ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)
#### Post date: [March 27, 2019, 8:26am UTC](https://discuss.elastic.co/t/what-is-timeout-to-write-to-replica-shard/173966/6 "2019-03-27T08:26:50Z")

</div>

> [@oraclept](#):
>
> I dont see any exception on disconnected node

By default Elasticsearch does log something when a node is disconnected, and continues to log failure messages every few minutes if it can't reconnect. You're not sharing very much in the way of logs so it's not very easy to help here. Can you share the last few minutes of logs leading up to this `NodeNotConnectedException`? Perhaps use [https://gist.github.com](https://gist.github.com).

> [@oraclept](#):
>
> should I increase node timeout value

I don't understand. What timeout are you asking about?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [April 24, 2019, 8:27am UTC](https://discuss.elastic.co/t/what-is-timeout-to-write-to-replica-shard/173966/7 "2019-04-24T08:27:06Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
