NOTE: You are looking at documentation for an older release. For the latest information, see the current release documentation.
Update by query context
editUpdate by query context
editUse a Painless script in an update by query operation to add, modify, or delete fields within each of a set of documents collected as the result of query.
Variables
-
params
(Map
, read-only) - User-defined parameters passed in as part of the query.
-
ctx['op']
(String
) - The name of the operation.
-
ctx['_routing']
(String
, read-only) - The value used to select a shard for document storage.
-
ctx['_index']
(String
, read-only) - The name of the index.
-
ctx['_type']
(String
, read-only) - The type of document within an index.
-
ctx['_id']
(int
, read-only) - The unique document id.
-
ctx['_version']
(int
, read-only) - The current version of the document.
-
ctx['_source']
(Map
) -
Contains extracted JSON in a
Map
andList
structure for the fields existing in a stored document.
Side Effects
-
ctx['op']
-
Use the default of
index
to update a document. Set tonone
to specify no operation ordelete
to delete the current document from the index. -
ctx['_source']
-
Modify the values in the
Map/List
structure to add, modify, or delete the fields of a document.
Return
-
void
- No expected return value.
API
The standard Painless API is available.