From 3f3ba3c7cd84b661564d0f5701746f406769ee30 Mon Sep 17 00:00:00 2001 From: James Rodewig Date: Wed, 28 Aug 2019 15:55:31 -0400 Subject: [PATCH 1/3] [DOCS] Add "index template exists" API docs --- docs/reference/indices.asciidoc | 7 +++ .../indices/template-exists.asciidoc | 51 +++++++++++++++++++ docs/reference/indices/templates.asciidoc | 22 +------- docs/reference/rest-api/common-parms.asciidoc | 7 +++ 4 files changed, 67 insertions(+), 20 deletions(-) create mode 100644 docs/reference/indices/template-exists.asciidoc diff --git a/docs/reference/indices.asciidoc b/docs/reference/indices.asciidoc index 6769d786a6917..4acc0e5c6e74e 100644 --- a/docs/reference/indices.asciidoc +++ b/docs/reference/indices.asciidoc @@ -43,6 +43,11 @@ index settings, aliases, mappings, and index templates. * <> * <> * <> + +[float] +[[index-templates]] +=== Index templates: +* <> * <> [float] @@ -103,6 +108,8 @@ include::indices/get-settings.asciidoc[] include::indices/analyze.asciidoc[] +include::indices/template-exists.asciidoc[] + include::indices/templates.asciidoc[] include::indices/stats.asciidoc[] diff --git a/docs/reference/indices/template-exists.asciidoc b/docs/reference/indices/template-exists.asciidoc new file mode 100644 index 0000000000000..be52343542230 --- /dev/null +++ b/docs/reference/indices/template-exists.asciidoc @@ -0,0 +1,51 @@ +[[indices-template-exists]] +=== Index template exists API +++++ +Index template exists +++++ + +Checks if an index template exists. + +include::templates.asciidoc[tag=index-template-def] + +The returned HTTP status code indicates whether the index template exists. +A `404` means it does not exist, +and `200` means it does. + +[source,js] +----------------------------------------------- +HEAD /_template/template_1 +----------------------------------------------- +// CONSOLE + + +[[template-exists-api-request]] +==== {api-request-title} + +`HEAD /_template/` + + +[[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. diff --git a/docs/reference/indices/templates.asciidoc b/docs/reference/indices/templates.asciidoc index 60e65c3139454..dd86d4c6bba0f 100644 --- a/docs/reference/indices/templates.asciidoc +++ b/docs/reference/indices/templates.asciidoc @@ -1,11 +1,13 @@ [[indices-templates]] === Index Templates +// tag::index-template-def[] Index templates allow you to define templates that will automatically be applied when new indices are created. The templates include both <> and <> and a simple pattern template that controls whether the template should be applied to the new index. +// 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 @@ -119,26 +121,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 <>. - [float] [[multiple-templates]] ==== Multiple Templates Matching diff --git a/docs/reference/rest-api/common-parms.asciidoc b/docs/reference/rest-api/common-parms.asciidoc index 82023b70f890a..9fef125b0da7d 100644 --- a/docs/reference/rest-api/common-parms.asciidoc +++ b/docs/reference/rest-api/common-parms.asciidoc @@ -88,6 +88,13 @@ tag::index[] used to limit the request. end::index[] +tag::index-template[] +``:: +(Required, string) +Comma-separated list or wildcard expression of index template names +used to limit the request. +end::index-template[] + tag::local[] `local`:: (Optional, boolean) If `true`, the request retrieves information from the local From 8e8077d21ba354f1e82f34bcf91bf8662f2357b5 Mon Sep 17 00:00:00 2001 From: James Rodewig Date: Thu, 29 Aug 2019 08:36:15 -0400 Subject: [PATCH 2/3] remove response codes para --- docs/reference/indices/template-exists.asciidoc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/reference/indices/template-exists.asciidoc b/docs/reference/indices/template-exists.asciidoc index be52343542230..f56a6a61c85ba 100644 --- a/docs/reference/indices/template-exists.asciidoc +++ b/docs/reference/indices/template-exists.asciidoc @@ -8,10 +8,6 @@ Checks if an index template exists. include::templates.asciidoc[tag=index-template-def] -The returned HTTP status code indicates whether the index template exists. -A `404` means it does not exist, -and `200` means it does. - [source,js] ----------------------------------------------- HEAD /_template/template_1 From 80ca29331d511649613b78cab3a864e69618e751 Mon Sep 17 00:00:00 2001 From: James Rodewig Date: Thu, 29 Aug 2019 08:42:14 -0400 Subject: [PATCH 3/3] rework index template def --- docs/reference/indices/template-exists.asciidoc | 11 ++++++++++- docs/reference/indices/templates.asciidoc | 9 ++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/reference/indices/template-exists.asciidoc b/docs/reference/indices/template-exists.asciidoc index f56a6a61c85ba..550297a505982 100644 --- a/docs/reference/indices/template-exists.asciidoc +++ b/docs/reference/indices/template-exists.asciidoc @@ -6,7 +6,7 @@ Checks if an index template exists. -include::templates.asciidoc[tag=index-template-def] + [source,js] ----------------------------------------------- @@ -21,6 +21,15 @@ HEAD /_template/template_1 `HEAD /_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} diff --git a/docs/reference/indices/templates.asciidoc b/docs/reference/indices/templates.asciidoc index dd86d4c6bba0f..6d6591cc4ff3a 100644 --- a/docs/reference/indices/templates.asciidoc +++ b/docs/reference/indices/templates.asciidoc @@ -2,11 +2,10 @@ === Index Templates // tag::index-template-def[] -Index templates allow you to define templates that will automatically be -applied when new indices are created. The templates include both -<> and <> -and a simple pattern template that controls whether the template should be -applied to the new index. +Index templates define <> and <> +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