routing-field.asciidoc 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. [[mapping-routing-field]]
  2. === `_routing`
  3. The routing field allows to control the `_routing` aspect when indexing
  4. data and explicit routing control is required.
  5. [float]
  6. ==== store / index
  7. The first thing the `_routing` mapping does is to store the routing
  8. value provided (`store` set to `true`) and index it (`index` set to
  9. `not_analyzed`). The reason why the routing is stored by default is so
  10. reindexing data will be possible if the routing value is completely
  11. external and not part of the docs.
  12. [float]
  13. ==== required
  14. Another aspect of the `_routing` mapping is the ability to define it as
  15. required by setting `required` to `true`. This is very important to set
  16. when using routing features, as it allows different APIs to make use of
  17. it. For example, an index operation will be rejected if no routing value
  18. has been provided (or derived from the doc). A delete operation will be
  19. broadcasted to all shards if no routing value is provided and `_routing`
  20. is required.
  21. [float]
  22. ==== id uniqueness
  23. When indexing documents specifying a custom `_routing`, the uniqueness
  24. of the `_id` is not guaranteed throughout all the shards that the index
  25. is composed of. In fact, documents with the same `_id` might end up in
  26. different shards if indexed with different `_routing` values.