[[painless-ingest-processor-context]]
=== Ingest processor context

Use a Painless script in an {ref}/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.

{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.

`ctx` (`Map`)::
        Contains extracted JSON in a `Map` and `List` structure for the fields
        that are part of the document.

*Side Effects*

{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.

`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.