Multiple index routing allocation with require and include

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

"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 ?

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?

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.

Good idea.

So I'd tag some nodes with a tag like "hot-read" and allocate the index to those nodes (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?

Yes, thanks :slight_smile:

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