OpenSearch/docs/painless/painless-contexts/painless-field-context.asciidoc
Ryan Ernst 222652dfce
Scripting: Convert script fields to use script context (#34164)
This commit removes the use of SearchScript for script fields and adds
a new FieldScript.
2018-10-20 16:33:49 -07:00

29 lines
785 B
Plaintext

[[painless-field-context]]
=== Field context
Use a Painless script to create a
{ref}/search-request-script-fields.html[script field] to return
a customized value for each document in the results of a query.
*Variables*
`params` (`Map`, read-only)::
User-defined parameters passed in as part of the query.
`doc` (`Map`, read-only)::
Contains the fields of the specified document where each field is a
`List` of values.
{ref}/mapping-source-field.html[`params['_source']`] (`Map`, read-only)::
Contains extracted JSON in a `Map` and `List` structure for the fields
existing in a stored document.
*Return*
`Object`::
The customized value for each document.
*API*
The standard <<painless-api-reference, Painless API>> is available.