Hi,
here are steps to reproduce:
- Fresh installation of ES v 8.11
- Create an index "items" with a document containing a date:
curl --location --request PUT 'localhost:9200/items/_doc/1' \
--header 'Content-Type: application/json' \
--data '{"date": "2023-01-01"}'
- Create another index "data" containing a document with a text:
curl --location --request PUT 'localhost:9200/data/_doc/1' \
--header 'Content-Type: application/json' \
--data '{"someText": "foobar"}'
- Aggregate with stats aggregation over date field in item index:
curl --location 'localhost:9200/items/_search?size=0' \
--header 'Content-Type: application/json' \
--data '{
"aggregations": {
"md.issued.date": {
"stats": {
"field": "date"
}
}
}
}'
- Result:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": null,
"hits": []
},
"aggregations": {
"md.issued.date": {
"count": 1,
"min": 1.6725312E12,
"max": 1.6725312E12,
"avg": 1.6725312E12,
"sum": 1.6725312E12,
"min_as_string": "2023-01-01T00:00:00.000Z",
"max_as_string": "2023-01-01T00:00:00.000Z",
"avg_as_string": "2023-01-01T00:00:00.000Z",
"sum_as_string": "2023-01-01T00:00:00.000Z"
}
}
}
- Aggregate with stats over date field in all (*) indices:
curl --location 'localhost:9200/*/_search?size=0' \
--header 'Content-Type: application/json' \
--data '{
"aggregations": {
"md.issued.date": {
"stats": {
"field": "date"
}
}
}
}'
- Response:
"took": 1,
"timed_out": false,
"_shards": {
"total": 2,
"successful": 2,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 2,
"relation": "eq"
},
"max_score": null,
"hits": []
},
"aggregations": {
"md.issued.date": {
"count": 1,
"min": 1.6725312E12,
"max": 1.6725312E12,
"avg": 1.6725312E12,
"sum": 1.6725312E12
}
}
}
Why are the *_as_string fields (max_as_string, min_as_string, ...) missing in the response when I search over both indexes, and they are there when I search over the "items" index only? This used to work in Elasticsearch version 7.5, the fields were available in both cases.
Is this a bug or intended behaviour?
Thank you for any help and hints.