Why can index alias index routing only contain a single value?


(Bjfish) #1

Why can index alias index routing only contain a single value?

The guide mentions "Index routing can contain only a single value." http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html

It seems like it would be useful to index into multiple indexes at once so I am wondering why this isn't available.

Thank you.


(James Addison) #2

Routing is all about manipulating operations at the shard level, not index level. You can only add a document to a single shard within an index.

You can search multiple shards of course, which is why multiple routing values are permitted there. From the docs:

Routing

It is possible to associate routing values with aliases. This feature can be used together with filtering aliases in order to avoid unnecessary shard operations.

It’s also possible to specify different routing values for searching and indexing operations:

curl -XPOST 'http://localhost:9200/_aliases' -d '
{
    "actions" : [
        {
            "add" : {
                 "index" : "test",
                 "alias" : "alias2",
                 "search_routing" : "1,2",
                 "index_routing" : "2"
            }
        }
    ]
}'

As shown in the example above, search routing may contain several values separated by comma. Index routing can contain only a single value.


(system) #3