# Can I setup an index as "read-only" in just a few nodes, and expect ES to route correctly?

**URL:** <https://discuss.elastic.co/t/can-i-setup-an-index-as-read-only-in-just-a-few-nodes-and-expect-es-to-route-correctly/9211>\
**Category:** Elasticsearch\
**Created:** [October 2, 2012, 3:50pm UTC](https://discuss.elastic.co/t/can-i-setup-an-index-as-read-only-in-just-a-few-nodes-and-expect-es-to-route-correctly/9211 "2012-10-02T15:50:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon44344346](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@anon44344346](https://discuss.elastic.co/u/anon44344346)\
**Post date:** [October 2, 2012, 3:50pm UTC](https://discuss.elastic.co/t/can-i-setup-an-index-as-read-only-in-just-a-few-nodes-and-expect-es-to-route-correctly/9211/1 "2012-10-02T15:50:42Z")

</div>

Say I have 5 nodes, and one one index with the standard 1 shard - 5  
replicas configuration.

Can I configure the index, on a per node basis, as "read-only" in , say, 4  
of those nodes, and expect that when an indexing request is made, ES will  
route that to the one node that has write access to the index?

--

---

<div class="post-metadata">

**Author:** ![Artem\_Grinblat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/artem_grinblat/32/2327_2.png) [@Artem\_Grinblat](https://discuss.elastic.co/u/Artem_Grinblat)\
**Post date:** [October 2, 2012, 5:55pm UTC](https://discuss.elastic.co/t/can-i-setup-an-index-as-read-only-in-just-a-few-nodes-and-expect-es-to-route-correctly/9211/2 "2012-10-02T17:55:48Z")

</div>

IMHO, there can be no such thing as a read-only replica, the replicas would  
need to index the update in order to stay up to date with the primary shard.  
See also there[https://groups.google.com/d/msg/elasticsearch/I6YrFyRRNkQ/KhLpXfpGZKcJ](https://groups.google.com/d/msg/elasticsearch/I6YrFyRRNkQ/KhLpXfpGZKcJ):  
"There is no meaning to have balanced primary allocation since primary and  
replica shards do the same work."

As the question is interesting to me as well, I did some search. It looks  
like:

You can route the requests to the primary shard with the "\_primary"  
preference:  
[http://www.elasticsearch.org/guide/reference/api/search/preference.html](http://www.elasticsearch.org/guide/reference/api/search/preference.html)

You can move shards with  
[http://www.elasticsearch.org/guide/reference/api/admin-cluster-reroute.html](http://www.elasticsearch.org/guide/reference/api/admin-cluster-reroute.html)

Choosing a primary shard is being worked on:  
[https://groups.google.com/d/msg/elasticsearch/eDoenE7GHWA/ydyG7l3oL-4J](https://groups.google.com/d/msg/elasticsearch/eDoenE7GHWA/ydyG7l3oL-4J)

--

---

<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:** [July 6, 2017, 3:10am UTC](https://discuss.elastic.co/t/can-i-setup-an-index-as-read-only-in-just-a-few-nodes-and-expect-es-to-route-correctly/9211/3 "2017-07-06T03:10:31Z")

</div>


