get-mapping.asciidoc 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. [[indices-get-mapping]]
  2. === Get mapping API
  3. ++++
  4. <titleabbrev>Get mapping</titleabbrev>
  5. ++++
  6. Retrieves <<mapping,mapping definitions>> for one or more indices. For data
  7. streams, the API retrieves mappings for the stream's backing indices.
  8. [source,console]
  9. --------------------------------------------------
  10. GET /twitter/_mapping
  11. --------------------------------------------------
  12. // TEST[setup:twitter]
  13. [[get-mapping-api-request]]
  14. ==== {api-request-title}
  15. `GET /_mapping`
  16. `GET /<target>/_mapping`
  17. [[get-mapping-api-path-params]]
  18. ==== {api-path-parms-title}
  19. `<target>`::
  20. (Optional, string)
  21. Comma-separated list of data streams, indices, and index aliases used to limit
  22. the request. Wildcard expressions (`*`) are supported.
  23. +
  24. To target all data streams and indices in a cluster, omit this parameter or use
  25. `_all` or `*`.
  26. [[get-mapping-api-query-params]]
  27. ==== {api-query-parms-title}
  28. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
  29. +
  30. Defaults to `true`.
  31. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
  32. +
  33. Defaults to `open`.
  34. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
  35. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=local]
  36. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
  37. [[get-mapping-api-example]]
  38. ==== {api-examples-title}
  39. [[get-mapping-api-multi-ex]]
  40. ===== Multiple data streams and indices
  41. The get mapping API can be used to get more than one data stream or index with a
  42. single call. General usage of the API follows the following syntax:
  43. `host:port/<target>/_mapping` where `<target>` can accept a comma-separated
  44. list of names. To get mappings for all data streams and indices in a cluster, use `_all` or `*` for `<target>`
  45. or omit the `<target>` parameter.
  46. The following are some examples:
  47. [source,console]
  48. --------------------------------------------------
  49. GET /twitter,kimchy/_mapping
  50. --------------------------------------------------
  51. // TEST[setup:twitter]
  52. // TEST[s/^/PUT kimchy\nPUT book\n/]
  53. If you want to get mappings of all indices in a cluster, the following
  54. examples are equivalent:
  55. [source,console]
  56. --------------------------------------------------
  57. GET /*/_mapping
  58. GET /_all/_mapping
  59. GET /_mapping
  60. --------------------------------------------------
  61. // TEST[setup:twitter]