Hi all,
I have a doc with multiple fields (assume 10)
I want to preform an aggregation based on 2 fields of these documents. only if those fields are identical add them to the aggs.
Im trying to use a scripted agg like so:
{
"size": 0,
"aggs" : {
"blabla" : {
"terms" : {
"script" : "doc['solan_type'].value+doc['solan_device'].value"
}
}
}
}
but getting an error for painless syntax
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"doc['solan_type'].value+doc['solan_device'].value",
" ^---- HERE"
],
"script": "doc['solan_type'].value+doc['solan_device'].value",
"lang": "painless"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query_fetch",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "main_solan",
"node": "DpIfGrgeQm-RE34WMASY_A",
"reason": {
"type": "script_exception",
"reason": "runtime error",
"caused_by": {
"type": "null_pointer_exception",
"reason": null
},
"script_stack": [
"doc['solan_type'].value+doc['solan_device'].value",
" ^---- HERE"
],
"script": "doc['solan_type'].value+doc['solan_device'].value",
"lang": "painless"
}
}
],
"caused_by": {
"type": "script_exception",
"reason": "runtime error",
"caused_by": {
"type": "null_pointer_exception",
"reason": null
},
"script_stack": [
"doc['solan_type'].value+doc['solan_device'].value",
" ^---- HERE"
],
"script": "doc['solan_type'].value+doc['solan_device'].value",
"lang": "painless"
}
},
"status": 500
}
anyone knows how to preform this?
Thanks!