parent
e90c465640
commit
416652cdd8
|
@ -10,9 +10,9 @@ Adds a JSON document to the specified data stream or index and makes
|
||||||
it searchable. If the target is an index and the document already exists,
|
it searchable. If the target is an index and the document already exists,
|
||||||
the request updates the document and increments its version.
|
the request updates the document and increments its version.
|
||||||
|
|
||||||
NOTE: You cannot send update requests for existing documents to a data stream.
|
NOTE: You cannot use the index API to send update requests for existing
|
||||||
To update a document in a data stream, you must target the backing index
|
documents to a data stream. See <<update-delete-docs-in-a-data-stream>>
|
||||||
containing the document. See <<update-delete-docs-in-a-data-stream>>.
|
and <<update-delete-docs-in-a-backing-index>>.
|
||||||
|
|
||||||
[[docs-index-api-request]]
|
[[docs-index-api-request]]
|
||||||
==== {api-request-title}
|
==== {api-request-title}
|
||||||
|
@ -25,6 +25,11 @@ containing the document. See <<update-delete-docs-in-a-data-stream>>.
|
||||||
|
|
||||||
`POST /<target>/_create/<_id>`
|
`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
|
||||||
|
<<add-documents-to-a-data-stream>>.
|
||||||
|
|
||||||
[[docs-index-api-path-params]]
|
[[docs-index-api-path-params]]
|
||||||
==== {api-path-parms-title}
|
==== {api-path-parms-title}
|
||||||
|
|
||||||
|
@ -42,9 +47,19 @@ this request creates the index.
|
||||||
You can check for existing targets using the resolve index API.
|
You can check for existing targets using the resolve index API.
|
||||||
|
|
||||||
`<_id>`::
|
`<_id>`::
|
||||||
(Optional, string) Unique identifier for the document. Required if you are
|
(Optional, string) Unique identifier for the document.
|
||||||
using a PUT request. Omit to automatically generate an ID when using a
|
+
|
||||||
POST request.
|
--
|
||||||
|
This parameter is required for the following request formats:
|
||||||
|
|
||||||
|
* `PUT /<target>/_doc/<_id>`
|
||||||
|
* `PUT /<target>/_create/<_id>`
|
||||||
|
* `POST /<target>/_create/<_id>`
|
||||||
|
|
||||||
|
To automatically generate a document ID, use the `POST /<target>/_doc/` request
|
||||||
|
format and omit this parameter.
|
||||||
|
--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[[docs-index-api-query-params]]
|
[[docs-index-api-query-params]]
|
||||||
|
@ -214,9 +229,9 @@ already exists in the index.
|
||||||
[float]
|
[float]
|
||||||
===== Create document IDs automatically
|
===== Create document IDs automatically
|
||||||
|
|
||||||
If you don't specify a document ID when using POST, the `op_type` is
|
When using the `POST /<target>/_doc/` request format, the `op_type` is
|
||||||
automatically set to `create` and the index operation generates a unique ID
|
automatically set to `create` and the index operation generates a unique ID for
|
||||||
for the document.
|
the document.
|
||||||
|
|
||||||
[source,console]
|
[source,console]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue