Update a document | Elasticsearch API documentation (original) (raw)
Dismiss highlight Show more
Path parameters
- The name of the target index. By default, the index is created automatically if it doesn't exist.
- A unique identifier for the document to be updated.
Query parameters
- Only perform the operation if the document has this primary term.
- Only perform the operation if the document has this sequence number.
- True or false if to include the document source in the error message in case of parsing errors.
- The script language.
- If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search. If 'wait_for', it waits for a refresh to make this operation visible to search. If 'false', it does nothing with refreshes.
Values aretrue
,false
, orwait_for
. - If
true
, the destination must be an index alias. - The number of times the operation should be retried when a conflict occurs.
- A custom value used to route operations to a specific shard.
- The period to wait for the following operations: dynamic mapping updates and waiting for active shards. Elasticsearch waits for at least the timeout period before failing. The actual wait time could be longer, particularly when multiple waits occur.
- The number of copies of each shard that must be active before proceeding with the operation. Set to 'all' or any positive integer up to the total number of shards in the index (
number_of_replicas
+1). The default value of1
means it waits for each primary shard to be active. - _source
boolean | string | array[string]
Iffalse
, source retrieval is turned off. You can also specify a comma-separated list of the fields you want to retrieve. - The source fields you want to exclude.
- The source fields you want to retrieve.
application/json
Body Required
- If
true
, theresult
in the response is set tonoop
(no operation) when there are no changes to the document. - A partial update to an existing document. If both
doc
andscript
are specified,doc
is ignored. - If
true
, use the contents of 'doc' as the value of 'upsert'. NOTE: Using ingest pipelines withdoc_as_upsert
is not supported. - Hide script attributes Show script attributes object
- Specifies any named parameters that are passed into the script as variables. Use parameters instead of hard-coded values to decrease compile time.
Hide params attribute Show params attribute object
* *
object Additional properties lang string
Values are
painless
,expression
,mustache
, orjava
.- Hide options attribute Show options attribute object
* *
string Additional properties
- Specifies any named parameters that are passed into the script as variables. Use parameters instead of hard-coded values to decrease compile time.
- If
true
, run the script whether or not the document exists. _source boolean | object
Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered.
- If the document does not already exist, the contents of 'upsert' are inserted as a new document. If the document exists, the 'script' is run.
Responses
- 200 application/json
Hide response attributes Show response attributes object- The primary term assigned to the document for the indexing operation.
- Values are
created
,updated
,deleted
,not_found
, ornoop
. - Hide _shards attributes Show _shards attributes object
* Hide failures attributes Show failures attributes object
* Hide reason attributes Show reason attributes object
* The type of error
* A human-readable explanation of the error, in English.
* The server stack trace. Present only if theerror_trace=true
parameter was sent with the request. - Hide get attributes Show get attributes object
* Hide fields attribute Show fields attribute object
* *
object Additional properties