[[indices-get-mapping]] === Get mapping API ++++ Get mapping ++++ Retrieves <> for one or more indices. For data streams, the API retrieves mappings for the stream's backing indices. [source,console] -------------------------------------------------- GET /my-index-000001/_mapping -------------------------------------------------- // TEST[setup:my_index] [[get-mapping-api-request]] ==== {api-request-title} `GET /_mapping` `GET //_mapping` [[get-mapping-api-prereqs]] ==== {api-prereq-title} * If the {es} {security-features} are enabled, you must have the `view_index_metadata` or `manage` <> for the target data stream, index, or alias. [[get-mapping-api-path-params]] ==== {api-path-parms-title} ``:: (Optional, string) Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. [[get-mapping-api-query-params]] ==== {api-query-parms-title} include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=allow-no-indices] + Defaults to `true`. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards] + Defaults to `open`. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable] include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=local] include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=master-timeout] [[get-mapping-api-example]] ==== {api-examples-title} [[get-mapping-api-multi-ex]] ===== Multiple data streams and indices The get mapping API can be used to get more than one data stream or index with a single call. General usage of the API follows the following syntax: `host:port//_mapping` where `` can accept a comma-separated list of names. To get mappings for all data streams and indices in a cluster, use `_all` or `*` for `` or omit the `` parameter. The following are some examples: [source,console] -------------------------------------------------- GET /my-index-000001,my-index-000002/_mapping -------------------------------------------------- // TEST[s/^/PUT my-index-000001\nPUT my-index-000002\n/] If you want to get mappings of all indices in a cluster, the following examples are equivalent: [source,console] -------------------------------------------------- GET /*/_mapping GET /_all/_mapping GET /_mapping -------------------------------------------------- // TEST[setup:my_index]