数据中有如下四条时间数据
"date": "2017-09-12 15:50:16"
"date": "2017-09-13 15:50:16"
"date": "2017-09-14 15:50:16"
"date": "2017-09-15 15:50:16"
索引创建的为
{ "mappings": {
"time": {
"properties": {
"date": {
"type": "date",
"format": "date_hour_minute_second" }} }}
使用 {
"query": {
"range": {
"date": {
"gt" : "2016-09-12 00:00:00",
"lt" : "2018-09-15 00:00:00"
}
}
}
}查询时可以查到4条,但是使用
"gt" : "2017-09-12 00:00:00",
"lt" : "2017-09-15 00:00:00"
或者
"gt" : "2017-09-12 00:00:00",
"lt" : "2018-09-15 00:00:00"
都无查询结果,不知道什么情况了
"date": "2017-09-12 15:50:16"
"date": "2017-09-13 15:50:16"
"date": "2017-09-14 15:50:16"
"date": "2017-09-15 15:50:16"
索引创建的为
{ "mappings": {
"time": {
"properties": {
"date": {
"type": "date",
"format": "date_hour_minute_second" }} }}
使用 {
"query": {
"range": {
"date": {
"gt" : "2016-09-12 00:00:00",
"lt" : "2018-09-15 00:00:00"
}
}
}
}查询时可以查到4条,但是使用
"gt" : "2017-09-12 00:00:00",
"lt" : "2017-09-15 00:00:00"
或者
"gt" : "2017-09-12 00:00:00",
"lt" : "2018-09-15 00:00:00"
都无查询结果,不知道什么情况了
1 个回复
rockybean - Elastic Certified Engineer, ElasticStack Fans,公众号:ElasticTalk
赞同来自: hansongnan
我这边测过是没有问题的,你自己再试一下吧……