get-mapping.asciidoc 2.5 KB

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