2018-07-02 17:44:36 -04:00
|
|
|
[[painless-reindex-context]]
|
|
|
|
=== Reindex context
|
|
|
|
|
2018-07-25 13:59:25 -04:00
|
|
|
Use a Painless script in a {ref}/docs-reindex.html[reindex] operation to
|
2018-07-02 17:44:36 -04:00
|
|
|
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.
|
|
|
|
|
2020-01-08 11:50:03 -05:00
|
|
|
`ctx['op']` (`String`)::
|
2018-07-02 17:44:36 -04:00
|
|
|
The name of the operation.
|
|
|
|
|
2018-07-25 13:59:25 -04:00
|
|
|
{ref}/mapping-routing-field.html[`ctx['_routing']`] (`String`)::
|
2018-07-02 17:44:36 -04:00
|
|
|
The value used to select a shard for document storage.
|
|
|
|
|
2018-07-25 13:59:25 -04:00
|
|
|
{ref}/mapping-index-field.html[`ctx['_index']`] (`String`)::
|
2018-07-02 17:44:36 -04:00
|
|
|
The name of the index.
|
|
|
|
|
2018-07-25 13:59:25 -04:00
|
|
|
{ref}/mapping-type-field.html[`ctx['_type']`] (`String`)::
|
2018-07-02 17:44:36 -04:00
|
|
|
The type of document within an index.
|
|
|
|
|
2018-07-25 13:59:25 -04:00
|
|
|
{ref}/mapping-id-field.html[`ctx['_id']`] (`int`, read-only)::
|
2018-07-02 17:44:36 -04:00
|
|
|
The unique document id.
|
|
|
|
|
|
|
|
`ctx['_version']` (`int`)::
|
|
|
|
The current version of the document.
|
|
|
|
|
2018-07-25 13:59:25 -04:00
|
|
|
{ref}/mapping-source-field.html[`ctx['_source']`] (`Map`)::
|
2018-07-02 17:44:36 -04:00
|
|
|
Contains extracted JSON in a `Map` and `List` structure for the fields
|
|
|
|
existing in a stored document.
|
|
|
|
|
|
|
|
*Side Effects*
|
|
|
|
|
2020-01-08 11:50:03 -05:00
|
|
|
`ctx['op']`::
|
2018-07-02 17:44:36 -04:00
|
|
|
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.
|
|
|
|
|
2018-07-25 13:59:25 -04:00
|
|
|
{ref}/mapping-routing-field.html[`ctx['_routing']`]::
|
2018-07-02 17:44:36 -04:00
|
|
|
Modify this to change the routing value for the current document.
|
|
|
|
|
2018-07-25 13:59:25 -04:00
|
|
|
{ref}/mapping-index-field.html[`ctx['_index']`]::
|
2018-07-02 17:44:36 -04:00
|
|
|
Modify this to change the destination index for the current document.
|
|
|
|
|
2018-07-25 13:59:25 -04:00
|
|
|
{ref}/mapping-type-field.html[`ctx['_type']`]::
|
2018-07-02 17:44:36 -04:00
|
|
|
Modify this to change the type for the current document.
|
|
|
|
|
2018-07-25 13:59:25 -04:00
|
|
|
{ref}/mapping-id-field.html[`ctx['_id']`]::
|
2018-07-02 17:44:36 -04:00
|
|
|
Modify this to change the id for the current document.
|
|
|
|
|
|
|
|
`ctx['_version']` (`int`)::
|
|
|
|
Modify this to modify the version for the current document.
|
|
|
|
|
2018-07-25 13:59:25 -04:00
|
|
|
{ref}/mapping-source-field.html[`ctx['_source']`]::
|
2018-07-02 17:44:36 -04:00
|
|
|
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*
|
|
|
|
|
2020-01-08 11:50:03 -05:00
|
|
|
The standard <<painless-api-reference, Painless API>> is available.
|