Closed
Description
A change made in (#62884) appears to have caused a regression. Though, I'm not sure if this is actually a "fixed" bug, and just happens to be a breaking change. A class cast exception appears when returning from a combine script as part of a scripted metric aggregation when the return is a Map<Long, Object> where serialization appears to only accept Map<String, Object>.
Steps to reproduce:
- Run elasticsearch 7.10.0
curl -X PUT "localhost:9200/testindex" -H 'Content-Type: application/json' -d'
{
"mappings": {
"properties": {
"instanceId": {
"store": true,
"type": "long"
}
}
}
}'
curl -X POST "localhost:9200/testindex/_doc" -H 'Content-Type: application/json' -d'
{
"instanceId": 1
}
'
curl -X POST "localhost:9200/_search" -H 'Content-Type: application/json' -d'
{
"query": {
"match_all": {}
},
"aggs": {
"profit": {
"scripted_metric": {
"init_script": "state.test = [:]",
"map_script": "state.test[doc.instanceId.value] = 1",
"combine_script": "return state.test",
"reduce_script": "return 0"
}
}
}
}'
Steps 2 and 3 are separate because it seems like the response was masked if done together.
I found this by bisecting with the last known good commit as cd584d49dcc3819821c677973e388f4103f89418
and the first bad commit as 78a93dc18fb3db9a1b9785de34753b499f8bcbf8
from the root branch tag of v7.10.0
cc @jimczi