tier-field.asciidoc 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. [[mapping-tier-field]]
  2. === `_tier` field
  3. When performing queries across multiple indexes, it is sometimes desirable to
  4. target indexes held on nodes of a given data tier (`data_hot`, `data_warm`, `data_cold` or `data_frozen`).
  5. The `_tier` field allows matching on the `tier_preference` setting of the index a document was indexed into.
  6. The preferred value is accessible in certain queries :
  7. [source,console]
  8. --------------------------
  9. PUT index_1/_doc/1
  10. {
  11. "text": "Document in index 1"
  12. }
  13. PUT index_2/_doc/2?refresh=true
  14. {
  15. "text": "Document in index 2"
  16. }
  17. GET index_1,index_2/_search
  18. {
  19. "query": {
  20. "terms": {
  21. "_tier": ["data_hot", "data_warm"] <1>
  22. }
  23. }
  24. }
  25. --------------------------
  26. <1> Querying on the `_tier` field
  27. Typically a query will use a `terms` query to list the tiers of interest but you can use
  28. the `_tier` field in any query that is rewritten to a `term` query, such as the
  29. `match`, `query_string`, `term`, `terms`, or `simple_query_string` query, as well as `prefix`
  30. and `wildcard` queries. However, it does not support `regexp` and `fuzzy`
  31. queries.
  32. The `tier_preference` setting of the index is a comma-delimited list of tier names
  33. in order of preference i.e. the preferred tier for hosting an index is listed first followed
  34. by potentially many fall-back options. Query matching only considers the first preference
  35. (the first value of a list).