2013-08-28 19:24:34 -04:00
|
|
|
[[indices-get-mapping]]
|
2019-08-21 09:42:10 -04:00
|
|
|
=== Get mapping API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Get mapping</titleabbrev>
|
|
|
|
++++
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2020-07-13 09:05:03 -04:00
|
|
|
Retrieves <<mapping,mapping definitions>> for one or more indices. For data
|
|
|
|
streams, the API retrieves mappings for the stream's backing indices.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2020-07-31 09:51:47 -04:00
|
|
|
GET /my-index-000001/_mapping
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2020-07-31 09:51:47 -04:00
|
|
|
// TEST[setup:my_index]
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-01-14 16:08:01 -05:00
|
|
|
NOTE: Before 7.0.0, the 'mappings' definition used to include a type name. Although mappings
|
|
|
|
in responses no longer contain a type name by default, you can still request the old format
|
2019-08-21 09:42:10 -04:00
|
|
|
through the parameter `include_type_name`. For more details, please see <<removal-of-types>>.
|
2019-01-14 16:08:01 -05:00
|
|
|
|
2019-08-21 09:42:10 -04:00
|
|
|
|
|
|
|
[[get-mapping-api-request]]
|
|
|
|
==== {api-request-title}
|
|
|
|
|
|
|
|
`GET /_mapping`
|
|
|
|
|
2020-07-13 09:05:03 -04:00
|
|
|
`GET /<target>/_mapping`
|
2019-08-21 09:42:10 -04:00
|
|
|
|
|
|
|
|
|
|
|
[[get-mapping-api-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
|
|
|
|
2020-07-13 09:05:03 -04:00
|
|
|
`<target>`::
|
|
|
|
(Optional, string)
|
|
|
|
Comma-separated list of data streams, indices, and index aliases used to limit
|
|
|
|
the request. Wildcard expressions (`*`) are supported.
|
|
|
|
+
|
|
|
|
To target all data streams and indices in a cluster, omit this parameter or use
|
|
|
|
`_all` or `*`.
|
2019-08-21 09:42:10 -04:00
|
|
|
|
|
|
|
|
|
|
|
[[get-mapping-api-query-params]]
|
|
|
|
==== {api-query-parms-title}
|
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
|
2020-02-24 05:57:32 -05:00
|
|
|
+
|
|
|
|
Defaults to `true`.
|
2019-08-21 09:42:10 -04:00
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
|
2019-08-21 09:42:10 -04:00
|
|
|
+
|
|
|
|
Defaults to `open`.
|
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=include-type-name]
|
2019-08-21 09:42:10 -04:00
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
|
2019-08-21 09:42:10 -04:00
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=local]
|
2019-08-21 09:42:10 -04:00
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
|
2019-08-21 09:42:10 -04:00
|
|
|
|
|
|
|
|
|
|
|
[[get-mapping-api-example]]
|
|
|
|
==== {api-examples-title}
|
|
|
|
|
|
|
|
[[get-mapping-api-multi-ex]]
|
2020-07-13 09:05:03 -04:00
|
|
|
===== Multiple data streams and indices
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2020-07-13 09:05:03 -04:00
|
|
|
The get mapping API can be used to get more than one data stream or index with a
|
2019-01-14 16:08:01 -05:00
|
|
|
single call. General usage of the API follows the following syntax:
|
2020-07-13 09:05:03 -04:00
|
|
|
`host:port/<target>/_mapping` where `<target>` can accept a comma-separated
|
|
|
|
list of names. To get mappings for all data streams and indices in a cluster, use `_all` or `*` for `<target>`
|
|
|
|
or omit the `<target>` parameter.
|
2019-01-14 16:08:01 -05:00
|
|
|
The following are some examples:
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2020-07-31 09:51:47 -04:00
|
|
|
GET /my-index-000001,my-index-000002/_mapping
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2020-07-31 09:51:47 -04:00
|
|
|
// TEST[s/^/PUT my-index-000001\nPUT my-index-000002\n/]
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2020-07-13 09:05:03 -04:00
|
|
|
If you want to get mappings of all indices in a cluster, the following
|
|
|
|
examples are equivalent:
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2020-07-13 09:05:03 -04:00
|
|
|
GET /*/_mapping
|
|
|
|
|
2016-09-01 13:05:22 -04:00
|
|
|
GET /_all/_mapping
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2016-09-01 13:05:22 -04:00
|
|
|
GET /_mapping
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2020-07-31 09:51:47 -04:00
|
|
|
// TEST[setup:my_index]
|