OpenSearch/docs/painless/painless-contexts/painless-reindex-context.as...

68 lines
2.1 KiB
Plaintext
Raw Normal View History

[[painless-reindex-context]]
=== Reindex context
Use a Painless script in a {ref}/docs-reindex.html[reindex] operation to
add, modify, or delete fields within each document in an original index as its
reindexed into a target index.
*Variables*
`params` (`Map`, read-only)::
User-defined parameters passed in as part of the query.
`ctx['_op']` (`String`)::
The name of the operation.
{ref}/mapping-routing-field.html[`ctx['_routing']`] (`String`)::
The value used to select a shard for document storage.
{ref}/mapping-index-field.html[`ctx['_index']`] (`String`)::
The name of the index.
{ref}/mapping-type-field.html[`ctx['_type']`] (`String`)::
The type of document within an index.
{ref}/mapping-id-field.html[`ctx['_id']`] (`int`, read-only)::
The unique document id.
`ctx['_version']` (`int`)::
The current version of the document.
{ref}/mapping-source-field.html[`ctx['_source']`] (`Map`)::
Contains extracted JSON in a `Map` and `List` structure for the fields
existing in a stored document.
*Side Effects*
`ctx['_op']`::
Use the default of `index` to update a document. Set to `none` to
specify no operation or `delete` to delete the current document from
the index.
{ref}/mapping-routing-field.html[`ctx['_routing']`]::
Modify this to change the routing value for the current document.
{ref}/mapping-index-field.html[`ctx['_index']`]::
Modify this to change the destination index for the current document.
{ref}/mapping-type-field.html[`ctx['_type']`]::
Modify this to change the type for the current document.
{ref}/mapping-id-field.html[`ctx['_id']`]::
Modify this to change the id for the current document.
`ctx['_version']` (`int`)::
Modify this to modify the version for the current document.
{ref}/mapping-source-field.html[`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-reference, Painless API>> is available.