Skip to content

Commit 68870ac

Browse files
bizybottvernum
authored andcommitted
Correct the documentation for create_doc privilege (#47784)
The documentation was added in #47584 but those docs did not reflect the up-to-date behavior of the feature.
1 parent e278fff commit 68870ac

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

docs/reference/docs/index_.asciidoc

+2-1
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

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

179187
--
180188

0 commit comments

Comments
 (0)