OpenSearch/docs/painless/painless-contexts/painless-ingest-processor-c...

41 lines
1.2 KiB
Plaintext
Raw Normal View History

[[painless-ingest-processor-context]]
=== Ingest processor context
Use a Painless script in an {es_version}/script-processor.html[ingest processor]
to modify documents upon insertion.
*Variables*
`params` (`Map`, read-only)::
User-defined parameters passed in as part of the query.
{es_version}/mapping-index-field.html[`ctx['_index']`] (`String`)::
The name of the index.
{es_version}/mapping-type-field.html[`ctx['_type']`] (`String`)::
The type of document within an index.
`ctx` (`Map`)::
Contains extracted JSON in a `Map` and `List` structure for the fields
that are part of the document.
*Side Effects*
{es_version}/mapping-index-field.html[`ctx['_index']`]::
Modify this to change the destination index for the current document.
{es_version}/mapping-type-field.html[`ctx['_type']`]::
Modify this to change the type for the current document.
`ctx` (`Map`, read-only)::
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.