2018-07-02 17:44:36 -04:00
|
|
|
[[painless-field-context]]
|
|
|
|
=== Field context
|
|
|
|
|
|
|
|
Use a Painless script to create a
|
2018-07-25 13:59:25 -04:00
|
|
|
{ref}/search-request-script-fields.html[script field] to return
|
2018-07-02 17:44:36 -04:00
|
|
|
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.
|
|
|
|
|
2018-10-20 19:33:49 -04:00
|
|
|
{ref}/mapping-source-field.html[`params['_source']`] (`Map`, read-only)::
|
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.
|
|
|
|
|
|
|
|
*Return*
|
|
|
|
|
|
|
|
`Object`::
|
|
|
|
The customized value for each document.
|
|
|
|
|
|
|
|
*API*
|
|
|
|
|
2018-10-20 19:33:49 -04:00
|
|
|
The standard <<painless-api-reference, Painless API>> is available.
|