/ update,
/ partial,
/ indexPartial update a document # Sometimes we may only need to update a portion fields of the document.
Examples # Update the org.id field of the document news_001 in the collection my-collection:
PUT /my-collection/_doc/news_001/_update { "sync":{ "replace":{ "org": { "id": "infinilabs" } } } } The API returns as following result:
{"_id":"0,0", "_key":"news_001", "result":"updated"} Pizza using the method of fetching a document, then merging partial updates and replacing it.
...
/ delete,
/ indexDelete a document # Delete a specific document from the specified collection by specifying its unique identifier.
Examples # Delete the document 0,0 from collection my-collection:
DELETE /my-collection/_doc/0,0 The API returns the following result:
{ "_id": "0,0", "result": "deleted", ... } Request # DELETE /<target>/_doc/<doc_id> Path parameters # <target>
(Required, string) Name of the collection to target. <doc_id>
(Required, string) Unique identifier for the document, support both _key or _id.
...
/ bulk,
/ indexBatch document operation # Provides a efficient way to perform multiple index, create, delete, and update operations in a single request.
Examples # POST /_bulk { "index" : { "_index" : "test", "_id" : "1" } } { "field1" : "value1" } { "delete" : { "_index" : "test", "_id" : "2" } } { "create" : { "_index" : "test", "_id" : "3" } } { "field1" : "value3" } { "update" : {"_id" : "1", "_index" : "test"} } { "doc" : {"field2" : "value2"} } The API returns the following result:
...