0
我试图通过聚合将我的文档按小时分组一段时间,但总是得到“期望的字段名称”异常但得到了[START_OBJECT]“?有什么问题?如何在弹性搜索聚合中将文档按小时分组?
{
"query" : {
"bool" : {
"must" : {
"range" : {
"timestamp" : {
"from" : "2017-08-14 00:00:00",
"to" : "2017-08-15 00:00:00",
"include_lower" : true,
"include_upper" : true
}
}
}
}
},
"aggs": {
"result_by_hours": {
"histogram": {
"script": "doc.timestamp.date.getHourOfDay()",
"interval": 1
}
}
}
}
我期望的是返回昨天每小时的文件数量。我如何使用动态实时代替“2017-08-14 - 2017-08-15”?
感谢提前:)
第二尝试也失败了:( “AGGS”:{ “result_by_hours”:{ “date_histogram”:{ “场”: “时间戳”, “间隔”: “小时”, “格式”:“ k“ } } } – Joey
什么是es版本? – sunkuet02
ES版本是2.3 – Joey