-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Closed
Labels
:Core/Infra/ScriptingScripting abstractions, Painless, and MustacheScripting abstractions, Painless, and Mustachediscussv6.0.3
Description
Elasticsearch version: master
Plugins installed: none
JVM version: 1.8.0_60
OS version: OSX El Capitan
Description of the problem including expected versus actual behavior:
According to the docs script_fields can access the document _source via a _source keyword. When attempting this with a Painless script, I get a Variable [_source] is not defined. error.
Steps to reproduce:
- Execute a query with a painless script_field that attempts to access _source, something like this:
"script_fields": {
"scriptip": {
"script": {
"inline": "return _source.ip;",
"lang": "painless"
}
}
}
Provide logs (if relevant):
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "compile error",
"script_stack": [
"return _source.ip;",
" ^---- HERE"
],
"script": "return _source.ip;",
"lang": "painless"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query_fetch",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "logstash-0",
"node": "00s71MPnSRenvz6mflLQeQ",
"reason": {
"type": "script_exception",
"reason": "compile error",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Variable [_source] is not defined."
},
"script_stack": [
"return _source.ip;",
" ^---- HERE"
],
"script": "return _source.ip;",
"lang": "painless"
}
}
],
"caused_by": {
"type": "script_exception",
"reason": "compile error",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Variable [_source] is not defined."
},
"script_stack": [
"return _source.ip;",
" ^---- HERE"
],
"script": "return _source.ip;",
"lang": "painless"
}
},
"status": 500
}
Describe the feature:
nezda, sunkuet02, jesseolsen, vlad0337187, hieudang-agilityio and 3 more
Metadata
Metadata
Assignees
Labels
:Core/Infra/ScriptingScripting abstractions, Painless, and MustacheScripting abstractions, Painless, and Mustachediscussv6.0.3