Skip to content

Commit

Permalink
[DOCS] Reuse aliases object properties in API docs (#73421) (#73662)
Browse files Browse the repository at this point in the history
Changes:
* Reuses the same `aliases` object properties in the following API docs:
  * Clone index API
  * Create index API
  * Put component template API
  * Put legacy index template API
  * Put index template API
  * Rollover index API
  * Shrink index API
  * Simulate template API
  * Split index API
* Updates the `aliases` object properties for the simulate index API docs.

Closes #73044
  • Loading branch information
jrodewig authored Jun 2, 2021
1 parent 4130852 commit 585bef6
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 33 deletions.
5 changes: 4 additions & 1 deletion docs/reference/indices/clone-index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
[[clone-index-api-request-body]]
==== {api-request-body-title}

include::{es-repo-dir}/indices/create-index.asciidoc[tag=aliases]
`aliases`::
(Optional, object of objects) Aliases for the resulting index.
+
include::{es-repo-dir}/indices/create-index.asciidoc[tag=aliases-props]

include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=target-index-settings]
26 changes: 15 additions & 11 deletions docs/reference/indices/create-index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ PUT /my-index-000001
==== {api-prereq-title}

* If the {es} {security-features} are enabled, you must have the `create_index`
or `manage` <<privileges-list-indices,index privilege>> for the target index.
or `manage` <<privileges-list-indices,index privilege>> for the target index. To
add the index to an alias, you must have the `manage` index privilege for the
alias.

[[indices-create-api-desc]]
==== {api-description-title}
Expand Down Expand Up @@ -68,13 +70,14 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
[[indices-create-api-request-body]]
==== {api-request-body-title}

// tag::aliases[]
`aliases`::
(Optional, object) Aliases for the index.
(Optional, object of objects) Aliases for the index.
+
.Properties of `aliases` objects
--
// tag::aliases-props[]
[%collapsible%open]
====
.Properties of `aliases` objects
=======
`<alias>`::
(Required, object) The key is the alias name. Supports
<<date-math-index-names,date math>>.
Expand All @@ -83,9 +86,9 @@ The object body contains options for the alias. Supports an empty object.
+
.Properties of `<alias>`
[%collapsible%open]
=====
======
`filter`::
(Optional, <<query-dsl,Query DSL object>>) Query used to limit the documents the
(Optional, <<query-dsl,Query DSL object>>) Query used to limit documents the
alias can access.

`index_routing`::
Expand All @@ -94,7 +97,7 @@ If specified, this overwrites the `routing` value for indexing operations.

`is_hidden`::
(Optional, Boolean) If `true`, the alias is <<hidden,hidden>>. Defaults to
`false`.
`false`. All indices for the alias must have the same `is_hidden` value.

`is_write_index`::
(Optional, Boolean) If `true`, the index is the <<write-index,write index>> for
Expand All @@ -107,9 +110,10 @@ specific shard.
`search_routing`::
(Optional, string) Value used to route search operations to a specific shard. If
specified, this overwrites the `routing` value for search operations.
=====
====
// end::aliases[]
======
=======
// end::aliases-props[]
--

include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=mappings]

Expand Down
13 changes: 10 additions & 3 deletions docs/reference/indices/put-component-template.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,28 @@ Defaults to `false`.

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

[role="child_attributes"]
[[put-component-template-api-request-body]]
==== {api-request-body-title}

`template`::
(Required, object)
This is the template to be applied, may optionally include a `mappings`,
`settings`, or `aliases` configuration.

include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=aliases]
+
NOTE: You cannot add data streams to an index alias.
.Properties of `template`
[%collapsible%open]
====
`aliases`::
(Optional, object of objects) Aliases for the index. If an index template
includes `data_stream`, this parameter is not supported.
+
include::{es-repo-dir}/indices/create-index.asciidoc[tag=aliases-props]
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=mappings]
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=settings]
====

`version`::
(Optional, integer)
Expand Down
7 changes: 5 additions & 2 deletions docs/reference/indices/put-index-template-v1.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ overriding templates with lower values.

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


[role="child_attributes"]
[[put-index-template-v1-api-request-body]]
==== {api-request-body-title}

Expand All @@ -123,7 +123,10 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
Array of wildcard expressions
used to match the names of indices during creation.

include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=aliases]
`aliases`::
(Optional, object of objects) Aliases for the index.
+
include::{es-repo-dir}/indices/create-index.asciidoc[tag=aliases-props]

include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=mappings]

Expand Down
6 changes: 4 additions & 2 deletions docs/reference/indices/put-index-template.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,11 @@ Template to be applied. It may optionally include an `aliases`, `mappings`, or
.Properties of `template`
[%collapsible%open]
====
include::{docdir}/rest-api/common-parms.asciidoc[tag=aliases]
`aliases`::
(Optional, object of objects) Aliases for the index. If the index template
includes `data_stream`, this parameter is not supported.
+
NOTE: You cannot add data streams to an index alias.
include::{es-repo-dir}/indices/create-index.asciidoc[tag=aliases-props]
include::{docdir}/rest-api/common-parms.asciidoc[tag=mappings]
Expand Down
6 changes: 4 additions & 2 deletions docs/reference/indices/rollover-index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,11 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
[[rollover-index-api-request-body]]
==== {api-request-body-title}

include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=aliases]
`aliases`::
(Optional, object of objects) Aliases for the target index. Data streams do not
support this parameter.
+
Data streams do not support this parameter.
include::{es-repo-dir}/indices/create-index.asciidoc[tag=aliases-props]

[[rollover-conditions]]
`conditions`::
Expand Down
5 changes: 4 additions & 1 deletion docs/reference/indices/shrink-index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
[[shrink-index-api-request-body]]
==== {api-request-body-title}

include::{es-repo-dir}/indices/create-index.asciidoc[tag=aliases]
`aliases`::
(Optional, object of objects) Aliases for the resulting index.
+
include::{es-repo-dir}/indices/create-index.asciidoc[tag=aliases-props]

include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=target-index-settings]

Expand Down
35 changes: 33 additions & 2 deletions docs/reference/indices/simulate-index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,40 @@ The settings, mappings, and aliases that would be applied to the index.
.Properties of `template`
[%collapsible%open]
====
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=aliases]
`aliases`::
(object) Aliases for the index. If no aliases apply, the response returns an
empty `aliases` object.
+
Response includes an empty object if no aliases would be applied.
=====
`<alias>`::
(object) The key is the alias name. The object body contains options for the
alias.
+
.Properties of `<alias>`
[%collapsible%open]
======
`filter`::
(<<query-dsl,Query DSL object>>) Query used to limit documents the alias can
access.
`index_routing`::
(string) Value used to route indexing operations to a specific shard. This
overwrites the `routing` value for indexing operations.
`is_hidden`::
(Boolean) If `true`, the alias is <<hidden,hidden>>.
`is_write_index`::
(Boolean) If `true`, the index is the <<write-index,write index>> for the alias.
`routing`::
(string) Value used to route indexing and search operations to a specific shard.
`search_routing`::
(string) Value used to route search operations to a specific shard. This
overwrites the `routing` value for search operations.
======
=====
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=mappings]
+
Expand Down
6 changes: 5 additions & 1 deletion docs/reference/indices/simulate-template.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ The settings, mappings, and aliases that would be applied to matching indices.
.Properties of `template`
[%collapsible%open]
====
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=aliases]
`aliases`::
(Optional, object of objects) Aliases for the index. If the index template
includes `data_stream`, this parameter is not supported.
+
include::{es-repo-dir}/indices/create-index.asciidoc[tag=aliases-props]
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=mappings]
Expand Down
5 changes: 4 additions & 1 deletion docs/reference/indices/split-index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
[[split-index-api-request-body]]
==== {api-request-body-title}

include::{es-repo-dir}/indices/create-index.asciidoc[tag=aliases]
`aliases`::
(Optional, object of objects) Aliases for the resulting index.
+
include::{es-repo-dir}/indices/create-index.asciidoc[tag=aliases-props]

include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=target-index-settings]
7 changes: 0 additions & 7 deletions docs/reference/rest-api/common-parms.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ Comma-separated list or wildcard expression of index alias names
used to limit the request.
end::index-alias[]

tag::aliases[]
`aliases`::
(Optional, <<indices-aliases,alias object>>) <<indices-aliases,Index aliases>>
which include the index. Index alias names support <<date-math-index-names,date
math>>.
end::aliases[]

tag::allow-no-indices[]
`allow_no_indices`::
(Optional, Boolean)
Expand Down

0 comments on commit 585bef6

Please sign in to comment.