From 9c017215ca969823689929a07ff855df1570c38f Mon Sep 17 00:00:00 2001 From: James Rodewig Date: Tue, 27 Aug 2019 14:24:42 -0400 Subject: [PATCH 1/5] [DOCS] Separate index alias exists API docs --- docs/reference/indices.asciidoc | 3 + docs/reference/indices/alias-exists.asciidoc | 83 ++++++++++++++++++++ docs/reference/indices/aliases.asciidoc | 13 --- 3 files changed, 86 insertions(+), 13 deletions(-) create mode 100644 docs/reference/indices/alias-exists.asciidoc diff --git a/docs/reference/indices.asciidoc b/docs/reference/indices.asciidoc index b3c9166437073..c8a3863b513a2 100644 --- a/docs/reference/indices.asciidoc +++ b/docs/reference/indices.asciidoc @@ -33,6 +33,7 @@ index settings, aliases, mappings, and index templates. [float] [[alias-management]] === Alias management: +* <> * <> [float] @@ -89,6 +90,8 @@ include::indices/get-field-mapping.asciidoc[] include::indices/types-exists.asciidoc[] +include::indices/alias-exists.asciidoc[] + include::indices/aliases.asciidoc[] include::indices/update-settings.asciidoc[] diff --git a/docs/reference/indices/alias-exists.asciidoc b/docs/reference/indices/alias-exists.asciidoc new file mode 100644 index 0000000000000..dbcd8997fdbde --- /dev/null +++ b/docs/reference/indices/alias-exists.asciidoc @@ -0,0 +1,83 @@ +[[indices-alias-exists]] +=== Index alias exists API +++++ +Index alias exists +++++ + +Checks if an index alias exists. + +An index alias is a secondary name +used to refer to one or more existing indices. + +The returned HTTP status code indicates whether the index alias exists or not. +A `404` means it does not exist, +and `200` means it does. + +[source,js] +---- +HEAD /_alias/alias1 +---- +// CONSOLE +// TEST[setup:twitter] +// TEST[s/^/PUT twitter\/_alias\/alias1\n/] + + +[[alias-exists-api-request]] +==== {api-request-title} + +`HEAD /_alias/` + +`HEAD //_alias/` + + +[[alias-exists-api-path-params]] +==== {api-path-parms-title} + +``:: +(Optional, string) +Comma-separated list +or wildcard expression of index names +used to limit the request. + + +``:: +(Required, string) +Comma-separated list +or wildcard expression of index alias names +used to limit the request. + +[[alias-exists-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 `all`. + +include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable] + +include::{docdir}/rest-api/common-parms.asciidoc[tag=local] + + +[[alias-exists-api-response-codes]] +==== {api-response-codes-title} + +`200`:: +Indicates all specified index aliases exist. + + `404`:: +Indicates one or more specified index aliases **do not** exist. + + +[[alias-exists-api-example]] +==== {api-examples-title} + +[source,js] +---- +HEAD /_alias/2030 +HEAD /_alias/20* +HEAD /logs_20302801/_alias/* +---- +// CONSOLE +// TEST[s/^/PUT logs_20302801\nPUT logs_20302801\/_alias\/2030\n/] diff --git a/docs/reference/indices/aliases.asciidoc b/docs/reference/indices/aliases.asciidoc index 03fa18bc8a448..bc207b9f226b0 100644 --- a/docs/reference/indices/aliases.asciidoc +++ b/docs/reference/indices/aliases.asciidoc @@ -575,16 +575,3 @@ Response: } -------------------------------------------------- // TESTRESPONSE - -There is also a HEAD variant of the get indices aliases api to check if -index aliases exist. The indices aliases exists api supports the same -option as the get indices aliases api. Examples: - -[source,js] --------------------------------------------------- -HEAD /_alias/2016 -HEAD /_alias/20* -HEAD /logs_20162801/_alias/* --------------------------------------------------- -// CONSOLE -// TEST[continued] From 6b79e3e7275a1da49e7ac40bae91f6678ab20d5c Mon Sep 17 00:00:00 2001 From: James Rodewig Date: Tue, 27 Aug 2019 14:44:58 -0400 Subject: [PATCH 2/5] Add tags for index alias definition --- docs/reference/indices/alias-exists.asciidoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/reference/indices/alias-exists.asciidoc b/docs/reference/indices/alias-exists.asciidoc index dbcd8997fdbde..70b648257671a 100644 --- a/docs/reference/indices/alias-exists.asciidoc +++ b/docs/reference/indices/alias-exists.asciidoc @@ -6,8 +6,10 @@ Checks if an index alias exists. +//tag::index-alias-def[] An index alias is a secondary name used to refer to one or more existing indices. +//end::index-alias-def[] The returned HTTP status code indicates whether the index alias exists or not. A `404` means it does not exist, From 428adffa742d1010454184b12c0758f5b8970c14 Mon Sep 17 00:00:00 2001 From: James Rodewig Date: Tue, 27 Aug 2019 19:45:42 -0400 Subject: [PATCH 3/5] Remove unneeded line breaks --- docs/reference/indices/alias-exists.asciidoc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/reference/indices/alias-exists.asciidoc b/docs/reference/indices/alias-exists.asciidoc index 70b648257671a..870db8e78f1dd 100644 --- a/docs/reference/indices/alias-exists.asciidoc +++ b/docs/reference/indices/alias-exists.asciidoc @@ -37,15 +37,13 @@ HEAD /_alias/alias1 ``:: (Optional, string) -Comma-separated list -or wildcard expression of index names +Comma-separated list or wildcard expression of index names used to limit the request. ``:: (Required, string) -Comma-separated list -or wildcard expression of index alias names +Comma-separated list or wildcard expression of index alias names used to limit the request. [[alias-exists-api-query-params]] From f38019b63b5b08721de94a964a907e355d1ef291 Mon Sep 17 00:00:00 2001 From: James Rodewig Date: Wed, 28 Aug 2019 08:43:15 -0400 Subject: [PATCH 4/5] reuse index parm --- docs/reference/indices/alias-exists.asciidoc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/reference/indices/alias-exists.asciidoc b/docs/reference/indices/alias-exists.asciidoc index 870db8e78f1dd..eca8e11b29e75 100644 --- a/docs/reference/indices/alias-exists.asciidoc +++ b/docs/reference/indices/alias-exists.asciidoc @@ -35,10 +35,7 @@ HEAD /_alias/alias1 [[alias-exists-api-path-params]] ==== {api-path-parms-title} -``:: -(Optional, string) -Comma-separated list or wildcard expression of index names -used to limit the request. +include::{docdir}/rest-api/common-parms.asciidoc[tag=index] ``:: From 5a488056d94c22f920f13ed3559cd87556805ce8 Mon Sep 17 00:00:00 2001 From: James Rodewig Date: Wed, 28 Aug 2019 08:44:09 -0400 Subject: [PATCH 5/5] reorder path parms --- docs/reference/indices/alias-exists.asciidoc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/reference/indices/alias-exists.asciidoc b/docs/reference/indices/alias-exists.asciidoc index eca8e11b29e75..c7790e6a6037c 100644 --- a/docs/reference/indices/alias-exists.asciidoc +++ b/docs/reference/indices/alias-exists.asciidoc @@ -35,14 +35,13 @@ HEAD /_alias/alias1 [[alias-exists-api-path-params]] ==== {api-path-parms-title} -include::{docdir}/rest-api/common-parms.asciidoc[tag=index] - - ``:: (Required, string) Comma-separated list or wildcard expression of index alias names used to limit the request. +include::{docdir}/rest-api/common-parms.asciidoc[tag=index] + [[alias-exists-api-query-params]] ==== {api-query-parms-title}