有人可以告诉我如何在ElasticSearch enter code here
中正确构建范围构面吗?我已经尝试了几种日期格式的变体,但总是得到异常。这是简单的版本:
{
"facets": {
"hdwm": {
"range": {
"field": "@timestamp",
"ranges": [
"{'to' : '2013-12-20' }",
"{'from': '2013-12-20', 'to' : '2013-12-25' }",
"{'from': '203-12-25' }"
]
}
}
},
"query": {
"match_all": {}
}
}
@timestamp字段定义为:
@timestamp: {
format: dateOptionalTime
type: date
}
并具有以下值:
@timestamp: 2013-11-20T01:20:37.527Z
答案 0 :(得分:1)
以下为我工作。我想问题是关于'/“
的语法和用法{
"facets": {
"hdwm": {
"range": {
"field": "@timestamp",
"ranges": [
{
"to": "2013-12-30"
},
{
"from": "2013-12-30",
"to": "2013-12-31"
},
{
"from": "2013-12-31"
}
]
}
}
},
"query": {
"match_all": {}
}
}