即使存在与查询匹配的结果,以下查询也会返回空结果。
GET abc*/_search
{
"query": {
"bool": {
"must": [
{"range": {
"timestamp": {
"gte": "2018-01-01T00:00:00.000",
"lte": "2018-01-02T12:00:00.465"
}
}}
]
}
}
}
当我用must_not替换must时,我得到的结果。以下是我的索引数据
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 6,
"successful": 6,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "abc",
"_type": "log",
"_id": "abc3423498239048290",
"_score": 1,
"_source": {
"0": {
"test": 289,
"testnested": {
"testnested1": 0,
"testnested2": 0.615,
},
"test1": 46.17,
"test2": 59.4,
"ts": "2018-01-01T00:08:20.396UTC"
},
"1":{
----------
----------
},
........
"10":{
------------------
},
"timestamp": "2018-01-01T00:08:20.396UTC",
}
-----------
}
我有什么问题吗?.timestamp字段的类型为" date_hour_minute_second_millis"。我正在使用Elasticsearch版本5+。我在另一个索引中使用了相同的查询,它在那里工作。