Routing explained


(Steff) #1

Hi

I think the routing-feature in ES needs a little more explanation, than
what I am able to find in the guide on
http://www.elasticsearch.org/guide/.
http://www.elasticsearch.org/guide/reference/mapping/routing-field.html
says something about how to set routing field, but nothing about exactly
what routing means and does for you, and how it works. I expect that the
routing field in general controls which shards ES will contact in order
to execute an "operation" (index, get, search etc.). Is that true?

Exactly what "guaranteed properties" does routing bring to the table? I
believe I've read somewhere that it is guaranteed that documents with
the same value for the routing field will always be indexed in the same
shard. Is that true? Other things worth mentioning about what routing
does for you? A little more documentation, not only on how to use it,
but also on how it works and what it does for you, would be nice.

Thanks!

Regards, Per Steffensen


(Benjamin Dev├Ęze) #2

If no routing is specified the targeted shard of a document is based on the
id of the document.

If you use routing the targeted shard is based on the provided routing so
the same value of routing field will always lead to the same shard.

Note that the _parent property can also be used for shard computation.


(system) #3