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] Add "index template exists" API docs #46095

Merged
merged 4 commits into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/reference/indices.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ index settings, aliases, mappings, and index templates.
* <<indices-update-settings>>
* <<indices-get-settings>>
* <<indices-analyze>>

[float]
[[index-templates]]
=== Index templates:
* <<indices-template-exists>>
* <<indices-templates>>

[float]
Expand Down Expand Up @@ -109,6 +114,8 @@ include::indices/get-settings.asciidoc[]

include::indices/analyze.asciidoc[]

include::indices/template-exists.asciidoc[]

include::indices/templates.asciidoc[]

include::indices/stats.asciidoc[]
Expand Down
56 changes: 56 additions & 0 deletions docs/reference/indices/template-exists.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[[indices-template-exists]]
=== Index template exists API
++++
<titleabbrev>Index template exists</titleabbrev>
++++

Checks if an index template exists.



[source,js]
-----------------------------------------------
HEAD /_template/template_1
-----------------------------------------------
// CONSOLE


[[template-exists-api-request]]
==== {api-request-title}

`HEAD /_template/<index-template>`


[[template-exists-api-desc]]
==== {api-description-title}

Use the index template exists API
to determine whether one or more index templates exist.

include::templates.asciidoc[tag=index-template-def]


[[template-exists-api-path-params]]
==== {api-path-parms-title}

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


[[template-exists-api-query-params]]
==== {api-query-parms-title}

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

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

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


[[template-exists-api-response-codes]]
==== {api-response-codes-title}

`200`::
Indicates all specified index templates exist.

`404`::
Indicates one or more specified index templates **do not** exist.
31 changes: 6 additions & 25 deletions docs/reference/indices/templates.asciidoc
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[[indices-templates]]
=== Index Templates

Index templates allow you to define templates that will automatically be
applied when new indices are created. The templates include both
<<index-modules-settings,settings>> and <<mapping,mappings>>
and a simple pattern template that controls whether the template should be
applied to the new index.
// tag::index-template-def[]
Index templates define <<index-modules-settings,settings>> and <<mapping,mappings>>
that you can automatically apply when creating new indices.
{es} applies templates to new indices
based on an index pattern that matches the index name.
// end::index-template-def[]

NOTE: Templates are only applied at index creation time. Changing a template
will have no impact on existing indices. When using the create index API, the
Expand Down Expand Up @@ -119,26 +120,6 @@ GET /_template
--------------------------------------------------
// CONSOLE

[float]
[[indices-templates-exists]]
==== Template exists

Used to check if the template exists or not. For example:

[source,js]
-----------------------------------------------
HEAD _template/template_1
-----------------------------------------------
// CONSOLE

The HTTP status code indicates if the template with the given name
exists or not. Status code `200` means it exists and `404` means
it does not.

NOTE: Before 7.0.0, the 'mappings' definition used to include a type name. Although mappings
no longer contain a type name by default, you can still use the old format by setting
the parameter include_type_name. For more details, please see <<removal-of-types>>.

[float]
[[multiple-templates]]
==== Multiple Templates Matching
Expand Down
7 changes: 7 additions & 0 deletions docs/reference/rest-api/common-parms.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ tag::index[]
used to limit the request.
end::index[]

tag::index-template[]
`<index-template>`::
(Required, string)
Comma-separated list or wildcard expression of index template names
used to limit the request.
end::index-template[]

tag::lenient[]
`lenient`::
(Optional, boolean) If `true`, format-based query failures (such as
Expand Down