[7.x] Adding new require_alias option to indexing requests (#58917) (#59769)

* Adding new `require_alias` option to indexing requests (#58917)

This commit adds the `require_alias` flag to requests that create new documents.

This flag, when `true` prevents the request from automatically creating an index. Instead, the destination of the request MUST be an alias.

When the flag is not set, or `false`, the behavior defaults to the `action.auto_create_index` settings.

This is useful when an alias is required instead of a concrete index.

closes https://github.com/elastic/elasticsearch/issues/55267
This commit is contained in:
Benjamin Trent 2020-07-17 10:24:58 -04:00 committed by GitHub
parent 65f6fb8e94
commit b7f30fc929
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 447 additions and 36 deletions

View file

@ -25,9 +25,9 @@ and <<update-delete-docs-in-a-backing-index>>.
`POST /<target>/_create/<_id>`
IMPORTANT: You cannot add new documents to a data stream using the
`PUT /<target>/_doc/<_id>` request format. To specify a document ID, use the
`PUT /<target>/_create/<_id>` format instead. See
IMPORTANT: You cannot add new documents to a data stream using the
`PUT /<target>/_doc/<_id>` request format. To specify a document ID, use the
`PUT /<target>/_create/<_id>` format instead. See
<<add-documents-to-a-data-stream>>.
[[docs-index-api-path-params]]
@ -94,6 +94,8 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=version_type]
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=wait_for_active_shards]
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=require-alias]
[[docs-index-api-request-body]]
==== {api-request-body-title}

View file

@ -53,6 +53,8 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=if_primary_term]
`lang`::
(Optional, string) The script language. Default: `painless`.
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=require-alias]
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=refresh]
`retry_on_conflict`::

View file

@ -592,6 +592,12 @@ such as `1264`.
A value of `-1` indicates {es} was unable to compute this number.
end::memory[]
tag::require-alias[]
`require_alias`::
(Optional, boolean) When true, this requires the destination to be an alias.
Defaults to false.
end::require-alias[]
tag::node-filter[]
`<node_filter>`::
(Optional, string)