Skip to content

Commit 31f13e8

Browse files
authored
Correct the documentation for create_doc privilege (#49354)
The documentation was added in #47584 but those docs did not reflect the up-to-date behavior of the feature. Backport of: #47784
1 parent ba0c848 commit 31f13e8

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

docs/reference/docs/index_.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ include::{docdir}/rest-api/common-parms.asciidoc[tag=if_primary_term]
4545
(Optional, enum) Set to `create` to only index the document
4646
if it does not already exist (_put if absent_). If a document with the specified
4747
`_id` already exists, the indexing operation will fail. Same as using the
48-
`<index>/_create` endpoint. Valid values: `index`, `create`. Default: `index`.
48+
`<index>/_create` endpoint. Valid values: `index`, `create`.
49+
If document id is specified, it defaults to `index`. Otherwise, it defaults to `create`.
4950

5051
include::{docdir}/rest-api/common-parms.asciidoc[tag=pipeline]
5152

x-pack/docs/en/security/authorization/privileges.asciidoc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,18 @@ Privilege to index documents. Also grants access to the update mapping action.
164164
However, it does not enable a user to update existing documents.
165165
+
166166
--
167-
NOTE: When indexing documents with an external `_id` either via the index API or
168-
the bulk API, the request must use `op_type` as `create`. If `_id`s are
169-
generated automatically, the authorization happens as if the `op_type` is set to
170-
`create`.
167+
[NOTE]
168+
====
169+
170+
This privilege relies on the `op_type` of indexing requests (<<docs-index_>> and
171+
<<docs-bulk>>). When ingesting documents as a user who has the `create_doc`
172+
privilege (and no higher privilege such as `index` or `write`), you must ensure that
173+
'op_type' is set to 'create' through one of the following:
174+
175+
* Explicitly setting the `op_type` in the index or bulk APIs
176+
* Using the `_create` endpoint for the index API
177+
* Creating a document with an auto-generated `_id`
178+
====
171179

172180
--
173181

0 commit comments

Comments
 (0)