Files
elasticsearch-js/docs/reference-update.asciidoc
2024-12-05 14:46:46 -06:00

80 lines
4.6 KiB
Plaintext

[[reference-update]]
////////
===========================================================================================================================
|| ||
|| ||
|| ||
|| ██████╗ ███████╗ █████╗ ██████╗ ███╗ ███╗███████╗ ||
|| ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝ ||
|| ██████╔╝█████╗ ███████║██║ ██║██╔████╔██║█████╗ ||
|| ██╔══██╗██╔══╝ ██╔══██║██║ ██║██║╚██╔╝██║██╔══╝ ||
|| ██║ ██║███████╗██║ ██║██████╔╝██║ ╚═╝ ██║███████╗ ||
|| ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚══════╝ ||
|| ||
|| ||
|| This file is autogenerated, DO NOT send pull requests that changes this file directly. ||
|| You should update the script that does the generation, which can be found in: ||
|| https://github.com/elastic/elastic-client-generator-js ||
|| ||
|| You can run the script with the following command: ||
|| npm run elasticsearch -- --version <version> ||
|| ||
|| ||
|| ||
===========================================================================================================================
////////
[discrete]
=== client.update
Update a document. Updates a document by running a script or passing a partial document.
{ref}/docs-update.html[{es} documentation]
[discrete]
==== Function signature
[source,ts]
----
(UpdateRequest, options?): Promise<UpdateResponse>
----
[discrete]
===== `UpdateRequest`
[source,ts]
----
interface UpdateRequest<TDocument = unknown, TPartialDocument = unknown> extends <<shared-type-request-base, RequestBase>> {
id: <<shared-type-id, Id>>
index: <<shared-type-index-name, IndexName>>
if_primary_term?: <<shared-type-long, long>>
if_seq_no?: <<shared-type-sequence-number, SequenceNumber>>
lang?: string
refresh?: <<shared-type-refresh, Refresh>>
require_alias?: boolean
retry_on_conflict?: <<shared-type-integer, integer>>
routing?: <<shared-type-routing, Routing>>
timeout?: <<shared-type-duration, Duration>>
wait_for_active_shards?: <<shared-type-wait-for-active-shards, WaitForActiveShards>>
_source_excludes?: <<shared-type-fields, Fields>>
_source_includes?: <<shared-type-fields, Fields>>
detect_noop?: boolean
doc?: TPartialDocument
doc_as_upsert?: boolean
script?: <<shared-type-script, Script>> | string
scripted_upsert?: boolean
_source?: SearchSourceConfig
upsert?: TDocument
}
----
[discrete]
===== `UpdateResponse`
[source,ts]
----
type UpdateResponse<TDocument = unknown> = UpdateUpdateWriteResponseBase<TDocument>
----