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 alias exists API docs #46042

Merged
merged 5 commits into from
Aug 28, 2019
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 3 additions & 0 deletions docs/reference/indices.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ index settings, aliases, mappings, and index templates.
[float]
[[alias-management]]
=== Alias management:
* <<indices-alias-exists>>
* <<indices-aliases>>

[float]
Expand Down Expand Up @@ -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[]
Expand Down
83 changes: 83 additions & 0 deletions docs/reference/indices/alias-exists.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[[indices-alias-exists]]
=== Index alias exists API
++++
<titleabbrev>Index alias exists</titleabbrev>
++++

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,
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/<alias>`

`HEAD /<index>/_alias/<alias>`


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

`<index>`::
jrodewig marked this conversation as resolved.
Show resolved Hide resolved
(Optional, string)
jrodewig marked this conversation as resolved.
Show resolved Hide resolved
Comma-separated list or wildcard expression of index names
jrodewig marked this conversation as resolved.
Show resolved Hide resolved
used to limit the request.
jrodewig marked this conversation as resolved.
Show resolved Hide resolved


`<alias>`::
(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/]
13 changes: 0 additions & 13 deletions docs/reference/indices/aliases.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]