添加ES数据源使用timestamp字段无法解析,
官网文档,必须是Date类型
可以用多字段映射解决
POST java-20200712/_mapping
{
"properties": {
"start_time": {
"type": "long",
"fields": {
"as_date": {
"type": "date",
"format": "epoch_second"
}
}
}
}
}
然后用这个字段聚合
GET /java-20200712/_search
{
"size": 0,
"query": {
"match_all": {}
},
"aggs": {
"amount_per_day": {
"date_histogram": {
"field": "start_time.as_date",
"format": "yyyy-MM-dd",
"calendar_interval": "1d"
}
}
}
}
Comments | NOTHING