-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
:Core/Infra/ScriptingScripting abstractions, Painless, and MustacheScripting abstractions, Painless, and Mustache>bugTeam:Core/InfraMeta label for core/infra teamMeta label for core/infra team
Description
Executing a scripted_metric on an unsigned_long field fails, while the same works for long.
Minimal repro case:
PUT ul_test
{
"mappings": {
"properties": {
"a": {
"type": "unsigned_long"
}
}
}
}
POST ul_test/_doc/1
{
"a": 42
}
PUT l_test
{
"mappings": {
"properties": {
"a": {
"type": "long"
}
}
}
}
POST l_test/_doc/1
{
"a": 42
}
GET l_test/_search
{
"aggs": {
"sqrt": {
"scripted_metric": {
"init_script": "state.sqrd = []",
"map_script": "state.sqrd.add(doc.a.value * doc.a.value)",
"combine_script": "state.sqrd",
"reduce_script": "def sum = 0.0; for(l in states){ for(a in l) { sum += a}} return sum"
}
}
}
}
GET ul_test/_search
{
"aggs": {
"sqrt": {
"scripted_metric": {
"init_script": "state.sqrd = []",
"map_script": "state.sqrd.add(doc.a.value * doc.a.value)",
"combine_script": "state.sqrd",
"reduce_script": "def sum = 0.0; for(l in states){ for(a in l) { sum += a}} return sum"
}
}
}
}
error:
{
"error" : {
"root_cause" : [
{
"type" : "script_exception",
"reason" : "runtime error",
"script_stack" : [
"state.sqrd.add(doc.a.value * doc.a.value)",
" ^---- HERE"
],
"script" : "state.sqrd.add(doc.a.value * doc.a.value)",
"lang" : "painless",
"position" : {
"offset" : 20,
"start" : 0,
"end" : 41
}
}
],
Metadata
Metadata
Assignees
Labels
:Core/Infra/ScriptingScripting abstractions, Painless, and MustacheScripting abstractions, Painless, and Mustache>bugTeam:Core/InfraMeta label for core/infra teamMeta label for core/infra team