Skip to content

Commit

Permalink
[DOCS] Fix default for is_write_index (#77006) (#77362)
Browse files Browse the repository at this point in the history
This updates the default for the `is_write_index` parameter of the aliases API and create alias API.
The default behavior for `is_write_index` can vary based on:

1. Whether the alias is used for indices or data streams.
2. If an index alias, whether the alias points to multiple indices.

Co-authored-by: James Rodewig <[email protected]>

Co-authored-by: 诗心客 <[email protected]>
  • Loading branch information
jrodewig and shixinke authored Sep 7, 2021
1 parent ececfff commit f170f6c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 4 additions & 8 deletions docs/reference/alias.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ GET _alias/logs
[[write-index]]
=== Write index

If an alias points to multiple indices, you can use `is_write_index` to specify
a write index or data stream. {es} routes any write requests for the alias to
this index or data stream.
You can use `is_write_index` to specify a write index or data stream for an
alias. {es} routes any write requests for the alias to this index or data
stream.

[source,console]
----
Expand All @@ -235,11 +235,7 @@ POST _aliases
----
// TEST[s/^/PUT _data_stream\/logs-nginx.access-prod\nPUT _data_stream\/logs-my_app-default\n/]

If an alias points to multiple indices or data streams and `is_write_index`
isn't set, the alias rejects write requests. If an index alias points to one
index and `is_write_index` isn't set, the index automatically acts as the write
index. Data stream aliases don't automatically set a write data stream, even if
the alias points to one data stream.
include::{es-repo-dir}/indices/aliases.asciidoc[tag=write-index-defaults]

TIP: We recommend using data streams to store append-only time series data. If
you frequently update or delete existing time series data, use an index alias
Expand Down
12 changes: 10 additions & 2 deletions docs/reference/indices/aliases.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,16 @@ Only the `add` action supports this parameter.

// tag::alias-options[]
`is_write_index`::
(Optional, Boolean) If `true`, sets the <<write-index,write index or data
stream>> for the alias. Defaults to `false`.
(Optional, Boolean) If `true`, sets the write index or data stream for the
alias.
+
// tag::write-index-defaults[]
If an alias points to multiple indices or data streams and `is_write_index`
isn't set, the alias rejects write requests. If an index alias points to one
index and `is_write_index` isn't set, the index automatically acts as the write
index. Data stream aliases don't automatically set a write data stream, even if
the alias points to one data stream.
// end::write-index-defaults[]
// end::alias-options[]
+
Only the `add` action supports this parameter.
Expand Down

0 comments on commit f170f6c

Please sign in to comment.