ElasticSearch 时间区间查询无效

我也遇到过这种情况,时间区间查询无效,然后各种查询,说什么字段是string,然而我的就是date类型,可是还是无效

然后发现是我的创建表有两个字段 ,因为忘记从哪里copy过来的代码

@Field( index = false, store = true,type = FieldType.Date, format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")

我发现去掉

index = false

index:是否倒排索引;设置 fasle,无法被搜索,但依然支持aggs,sort,并出现在_source中

store = true 就可以查询到了

这是我的写法

 去掉后已经可以查询到数据了

 

posted on 2023-06-01 17:37  手撕高达的村长  阅读(189)  评论(0编辑  收藏  举报

导航