Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Rewrite get mapping API docs to use new format #44085

Closed
wants to merge 12 commits into from
86 changes: 56 additions & 30 deletions docs/reference/indices/get-mapping.asciidoc
Original file line number Diff line number Diff line change
@@ -1,45 +1,71 @@
[[indices-get-mapping]]
=== Get Mapping
== Get mapping API
++++
<titleabbrev>Get mapping</titleabbrev>
++++

The get mapping API allows to retrieve mapping definitions for an index or
index/type.

Returns mapping definitions for an index.

[float]
[[indices-get-mapping-example]]
=== {api-examples-title}

[source,js]
--------------------------------------------------
----
GET /twitter/_mapping
--------------------------------------------------
----
// CONSOLE
// TEST[setup:twitter]

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
through the parameter include_type_name. For more details, please see <<removal-of-types>>.
[float]
[[indices-get-mapping-request]]
=== {api-request-title}

`GET /{index}/_mapping`

[float]
==== Multiple Indices
[[indices-get-mapping-desc]]
=== {api-description-title}

The get mapping API can be used to get more than one index with a
single call. General usage of the API follows the following syntax:
`host:port/{index}/_mapping` where `{index}` can accept a comma-separated
list of names. To get mappings for all indices you can use `_all` for `{index}`.
The following are some examples:

[source,js]
--------------------------------------------------
GET /twitter,kimchy/_mapping
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]
// TEST[s/^/PUT kimchy\nPUT book\n/]
You can use the get mapping API to retrieve mapping definitions for one or
more indices.

If you want to get mappings of all indices and types then the following
two examples are equivalent:
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 through the parameter include_type_name. For more
details, please see <<removal-of-types>>.

[source,js]
--------------------------------------------------
GET /_all/_mapping
[float]
[[indices-get-mapping-path-params]]
=== {api-path-parms-title}

GET /_mapping
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]
`{index}`::
+
--
(Optional, string) Comma-separated list or wildcard expression of index names
for which to retrieve mapping definitions.

You can use a value of `_all` or `*` to retrieve mapping definitions for all
indices.

If no value is provided, the API retrieves mapping definitions for all indices.
--

[float]
[[indices-get-mapping-query-params]]
=== {api-query-parms-title}

include::multi-index-parameters.asciidoc[]

`include_type_name`::
(Optional, boolean) Indicates whether the type name is included in the response.
Defaults to `false`.

`local`::
(Optional, boolean) Indicates whether only local node information is included in
the response. Defaults to `false`. If `true`, state information is not retrieved
from the master node.

include::{docdir}/rest-api/timeoutparms.asciidoc[tag=master_timeout]
19 changes: 19 additions & 0 deletions docs/reference/indices/multi-index-parameters.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
`allow_no_indices`::
(Optional, boolean) Indicates whether the operation is skipped if a wildcard
expression matches no indices. Defaults to `false`.

`expand_wildcards`::
+
--
(Optional, string) Indicates whether wildcard expressions should expand to
<<indices-open-close, open or closed indices>>. Possible values are:

* `open` (Default)
* `closed`
* `none`
* `all`
--

`ignore_unavailable`::
(Optional, boolean) Indicates whether unavailable indices are skipped. Defaults
to `false`.
18 changes: 10 additions & 8 deletions docs/reference/rest-api/timeoutparms.asciidoc
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
`timeout`::
(time units) Specifies the period of time to wait for a response. If no
response is received before the timeout expires, the request fails and
returns an error. Defaults to `30s`. For more information about
time units, see <<time-units>>.
(Optional, time units) Specifies the period of time to wait for a response. If no
response is received before the timeout expires, the request fails and
returns an error. Defaults to `30s`. For more information about
time units, see <<time-units>>.

// tag::master_timeout[]
`master_timeout`::
(time units) Specifies the period of time to wait for a connection to the
master node. If no response is received before the timeout expires, the request
fails and returns an error. Defaults to `30s`. For more information about
time units, see <<time-units>>.
(Optional, time units) Specifies the period of time to wait for a connection to the
master node. If no response is received before the timeout expires, the request
fails and returns an error. Defaults to `30s`. For more information about
time units, see <<time-units>>.
// end::master_timeout[]