Elasticsearch scripted metric aggregation

(1)when i use scripted metric aggregation,in mapscript source,I put a java.util.set as a map-value,elasticsearch throws an exception
{size": 0,
"aggs": {
"collision": {
"scripted_metric": {
"init_script": {
"source": "params._agg.transactions=;",
"lang": "painless"
},
"map_script": {
"source":
"Map m = new HashMap();"+
"Set set = new HashSet();"+
"set.add(3);set.add(4);"+
"m.put('1',set);"
"params._agg.transactions.add(m);",
"lang": "painless"
}
}
}
}
}
(2)result as follows:
{
"took": 5,
"timed_out": false,
"_shards": {
"total": 2,
"successful": 1,
"skipped": 0,
"failed": 1,
"failures": [
{
"shard": 1,
"index": "cxf11",
"node": "CK7EYabxRguenWBXPTcH6Q",
"reason": {
"type": "unchecked_i_o_exception",
"reason": "unchecked_i_o_exception: java.io.IOException: can not write type [class java.util.HashSet]",
"caused_by": {
"type": "i_o_exception",
"reason": "can not write type [class java.util.HashSet]"
}
}
}
]
},
"hits": {
"total": 6,
"max_score": 0,
"hits":
},
"aggregations": {
"collision": {
"value": [
{
"transactions": [
{
"1": [
3,
4
]
},
{
"1": [
3,
4
]
},
{
"1": [
3,
4
]
},
{
"1": [
3,
4
]
},
{
"1": [
3,
4
]
},
{
"1": [
3,
4
]
}
]
}
]
}
}
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.