15
我试图寻找所有谁有一个范围之内日期字段中的项目,它失败(返回任何结果)过滤按日期elasticsearch
查询:
{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"range": {
"last_updated": {
"from": "2013-01-01 00:00:00"
}
}
}
}
}
}
的映射:
{
took: 1
timed_out: false
_shards: {
total: 1
successful: 1
failed: 0
}
hits: {
total: 0
max_score: null
hits: [ ]
}
}
:
{
"my_doctype": {
"_timestamp": {
"enabled": "true"
},
"properties": {
"cards": {
"type": "integer"
},
"last_updated": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
}
}
}
}
在结果
使用数值筛选整数字段(“卡”)的范围的相同查询可以正常工作。 将日期更改为较早的开始(1900-01-01 00:00:00)也不会显示结果。
我在做什么错?
顺便说一句,我知道我在映射中启用了_timestamp,但那不是我正在过滤的字段。
谢谢。这是我的一个错字 - 多么尴尬。 我要在这里留下问题并标记为已接受,供参考,如果有人需要看到测试用例。或者删除它更有意义? – eran 2013-03-26 18:55:39
@eran第四次在谷歌搜索“elasticsearch日期搜索(至少对我来说)。保留它,这对我很有用=) – markdsievers 2013-10-15 04:10:17
@Gil你可以更具体一些吗? – imotov 2014-03-04 15:33:39