get-mapping.asciidoc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 /my-index-000001/_mapping
  11. --------------------------------------------------
  12. // TEST[setup:my_index]
  13. [[get-mapping-api-request]]
  14. ==== {api-request-title}
  15. `GET /_mapping`
  16. `GET /<target>/_mapping`
  17. [[get-mapping-api-prereqs]]
  18. ==== {api-prereq-title}
  19. * If the {es} {security-features} are enabled, you must have the
  20. `view_index_metadata` or `manage` <<privileges-list-indices,index privilege>>
  21. for the target data stream, index, or index alias.
  22. [[get-mapping-api-path-params]]
  23. ==== {api-path-parms-title}
  24. `<target>`::
  25. (Optional, string)
  26. Comma-separated list of data streams, indices, and index aliases used to limit
  27. the request. Wildcard expressions (`*`) are supported.
  28. +
  29. To target all data streams and indices in a cluster, omit this parameter or use
  30. `_all` or `*`.
  31. [[get-mapping-api-query-params]]
  32. ==== {api-query-parms-title}
  33. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
  34. +
  35. Defaults to `true`.
  36. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
  37. +
  38. Defaults to `open`.
  39. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
  40. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=local]
  41. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
  42. [[get-mapping-api-example]]
  43. ==== {api-examples-title}
  44. [[get-mapping-api-multi-ex]]
  45. ===== Multiple data streams and indices
  46. The get mapping API can be used to get more than one data stream or index with a
  47. single call. General usage of the API follows the following syntax:
  48. `host:port/<target>/_mapping` where `<target>` can accept a comma-separated
  49. list of names. To get mappings for all data streams and indices in a cluster, use `_all` or `*` for `<target>`
  50. or omit the `<target>` parameter.
  51. The following are some examples:
  52. [source,console]
  53. --------------------------------------------------
  54. GET /my-index-000001,my-index-000002/_mapping
  55. --------------------------------------------------
  56. // TEST[s/^/PUT my-index-000001\nPUT my-index-000002\n/]
  57. If you want to get mappings of all indices in a cluster, the following
  58. examples are equivalent:
  59. [source,console]
  60. --------------------------------------------------
  61. GET /*/_mapping
  62. GET /_all/_mapping
  63. GET /_mapping
  64. --------------------------------------------------
  65. // TEST[setup:my_index]