Skip to content

Commit

Permalink
[DOCS] Reformat get mapping API. Reformat and reuse multi-index param…
Browse files Browse the repository at this point in the history
…s. (#45699)
  • Loading branch information
jrodewig committed Aug 21, 2019
1 parent 5c8dbce commit c636153
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 31 deletions.
28 changes: 3 additions & 25 deletions docs/reference/api-conventions.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,11 @@ ability to "exclude" (`-`), for example: `test*,-test3`.

All multi index APIs support the following url query string parameters:

[horizontal]
`ignore_unavailable`::

Controls whether to ignore if any specified indices are unavailable,
including indices that don't exist or closed indices. Either `true` or `false`
can be specified.

`allow_no_indices`::
include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]

Controls whether to fail if a wildcard indices expression results in no
concrete indices. Either `true` or `false` can be specified. For example if
the wildcard expression `foo*` is specified and no indices are available that
start with `foo`, then depending on this setting the request will fail. This
setting is also applicable when `_all`, `*`, or no index has been specified. This
settings also applies for aliases, in case an alias points to a closed index.
include::{docdir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]

`expand_wildcards`::

Controls what kind of concrete indices that wildcard indices expressions can expand
to. If `open` is specified then the wildcard expression is expanded to only
open indices. If `closed` is specified then the wildcard expression is
expanded only to closed indices. Also both values (`open,closed`) can be
specified to expand to all indices.
+
If `none` is specified then wildcard expansion will be disabled. If `all`
is specified, wildcard expressions will expand to all indices (this is equivalent
to specifying `open,closed`).
include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]

The defaults settings for the above parameters depend on the API being used.

Expand Down
50 changes: 44 additions & 6 deletions docs/reference/indices/get-mapping.asciidoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[[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.
Retrieves <<mapping,mapping definitions>> for indices in a cluster.

[source,js]
--------------------------------------------------
Expand All @@ -13,10 +15,46 @@ GET /twitter/_mapping

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>>.
through the parameter `include_type_name`. For more details, please see <<removal-of-types>>.

[float]
==== Multiple Indices

[[get-mapping-api-request]]
==== {api-request-title}

`GET /_mapping`

`GET /{index}/_mapping`


[[get-mapping-api-path-params]]
==== {api-path-parms-title}

include::{docdir}/rest-api/common-parms.asciidoc[tag=index]


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

include::{docdir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]

include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
+
Defaults to `open`.

include::{docdir}/rest-api/common-parms.asciidoc[tag=include-type-name]

include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]

include::{docdir}/rest-api/common-parms.asciidoc[tag=local]

include::{docdir}/rest-api/common-parms.asciidoc[tag=master-timeout]


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

[[get-mapping-api-multi-ex]]
===== Multiple indices

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:
Expand Down
42 changes: 42 additions & 0 deletions docs/reference/rest-api/common-parms.asciidoc
Original file line number Diff line number Diff line change
@@ -1,9 +1,38 @@

tag::allow-no-indices[]
`allow_no_indices`::
(Optional, boolean) If `true`, the request returns an error if a wildcard
expression or `_all` value retrieves only missing or closed indices. This
parameter also applies to <<indices-aliases,index aliases>> that point to a
missing or closed index.
end::allow-no-indices[]

tag::bytes[]
`bytes`::
(Optional, <<byte-units,byte size units>>) Unit used to display byte values.
end::bytes[]

tag::expand-wildcards[]
`expand_wildcards`::
+
--
(Optional, string) Controls what kind of indices that wildcard
expressions can expand to. Valid values are:

`all`::
Expand to open and closed indices.

`open`::
Expand only to open indices.

`closed`::
Expand only to closed indices.

`none`::
Wildcard expressions are not accepted.
--
end::expand-wildcards[]

tag::cat-h[]
`h`::
(Optional, string) Comma-separated list of column names to display.
Expand All @@ -28,6 +57,19 @@ https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html[HTTP accept header].
Valid values include JSON, YAML, etc.
end::http-format[]

tag::include-type-name[]
`include_type_name`::
deprecated:[7.0.0, Mapping types have been deprecated. See <<removal-of-types>>.]
(Optional, boolean) If `true`, a mapping type is expected in the body of
mappings. Defaults to `false`.
end::include-type-name[]

tag::index-ignore-unavailable[]
`ignore_unavailable`::
(Optional, boolean) If `true`, missing or closed indices are not included in the
response. Defaults to `false`.
end::index-ignore-unavailable[]

tag::include-unloaded-segments[]
`include_unloaded_segments`::
(Optional, boolean) If `true`, the response includes information from segments
Expand Down

0 comments on commit c636153

Please sign in to comment.