# Multiple index routing allocation with require and include

**URL:** <https://discuss.elastic.co/t/multiple-index-routing-allocation-with-require-and-include/253995>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [November 2, 2020, 8:45am UTC](https://discuss.elastic.co/t/multiple-index-routing-allocation-with-require-and-include/253995 "2020-11-02T08:45:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nopma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nopma/32/46878_2.png) [@nopma](https://discuss.elastic.co/u/nopma)\
**Post date:** [November 2, 2020, 8:45am UTC](https://discuss.elastic.co/t/multiple-index-routing-allocation-with-require-and-include/253995/1 "2020-11-02T08:45:14Z")

</div>

I am trying to set up index routing with require and include but is not working.

I have 3 nodes, and I want one shard to be on node-1 and the second shard to be on node-2 or 3.  
But when I try with this index template one of the shards is **UNASSIGNED**

```auto
"settings": {
     "number_of_shards": "1",
     "number_of_replicas": "1",
     "routing" : {
        "allocation" : {
            "include" : {
               "_name" : "es1,es2,es3"
            },
            "require": {
               "_name" : "es3"
           }
      }
   }
}

```

If i use only include or require is ok. Any ideas ?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 2, 2020, 9:12am UTC](https://discuss.elastic.co/t/multiple-index-routing-allocation-with-require-and-include/253995/2 "2020-11-02T09:12:36Z")

</div>

I believe that because of the require it can not assign the replica if only one node has the tag es3.

Could you describe why do you want to do this?

---

<div class="post-metadata">

**Author:** ![nopma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nopma/32/46878_2.png) [@nopma](https://discuss.elastic.co/u/nopma)\
**Post date:** [November 2, 2020, 9:33am UTC](https://discuss.elastic.co/t/multiple-index-routing-allocation-with-require-and-include/253995/3 "2020-11-02T09:33:39Z")

</div>

the idea is to manually allocate the index which is expected to have high read rates on a separate node so the queries do not affect the performance of other nodes.  
e.g. we have 10 indices: 1st is 200GB, others are 20-30GB each, replication will balance it between nodes. Cross-cluster search is an option, but it requires to have multiple clusters.  
generally we just need to replicate one single index (or pattern) to another node and keep a copy in the main cluster at the same time.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 2, 2020, 11:31am UTC](https://discuss.elastic.co/t/multiple-index-routing-allocation-with-require-and-include/253995/4 "2020-11-02T11:31:39Z")

</div>

> [@nopma](#):
>
> the idea is to manually allocate the index which is expected to have high read rates on a separate node so the queries do not affect the performance of other nodes.

Good idea.

So I'd tag some nodes with a tag like "hot-read" and allocate the index to those node **s** (the s is important). With that, you will be able to allocate all primaries and all replicas on all the nodes which has this tag.

Then I guess `require` is good to use.

And the exclude the other indices from those nodes.

Makes sense?

---

<div class="post-metadata">

**Author:** ![nopma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nopma/32/46878_2.png) [@nopma](https://discuss.elastic.co/u/nopma)\
**Post date:** [November 3, 2020, 8:02am UTC](https://discuss.elastic.co/t/multiple-index-routing-allocation-with-require-and-include/253995/5 "2020-11-03T08:02:50Z")

</div>

Yes, thanks 🙂

---

<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:** [December 1, 2020, 8:03am UTC](https://discuss.elastic.co/t/multiple-index-routing-allocation-with-require-and-include/253995/6 "2020-12-01T08:03:05Z")

</div>

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