Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eq 查询不到对应的数据 #20

Closed
MrLucy opened this issue Jun 23, 2022 · 2 comments
Closed

eq 查询不到对应的数据 #20

MrLucy opened this issue Jun 23, 2022 · 2 comments

Comments

@MrLucy
Copy link

MrLucy commented Jun 23, 2022

 LambdaEsQueryWrapper<Demo> wrapper = new LambdaEsQueryWrapper<>();
 wrapper.like(Demo::getMessage, demoDto.getMessage())
               .eq(Demo::getUserName, demoDto.getUserName())
              ...
demoMapper.selectList(wrapper);

比如这个 demoDto.getUserName() 的值为张三,es中是存在userName为张三的数据的,但是无法查询出来

@kinbod
Copy link

kinbod commented Jul 3, 2022

我也遇到类似问题,跟踪发现_count API使用的get,但是hightlevel javaAPI中使用的是post,不知道是不是这个原因造成的,我使用selectOne查询死活查不到,但是使用EE打印生成的语句然后再postman里面把POST换成get就可以查询到了,哎。。头疼。

@xpc1024
Copy link
Collaborator

xpc1024 commented Jul 4, 2022

ES中存在,不代表一定能被查出来,需要首先确认你的索引类型是否正确创建,eq对应的是termQuery,termQuery要求数据类型为keyword类型,如果你的索引类型为text,就不会被查出来,另外如果你的字段类是keyword&text双类型,那么此时查询时,字段名需要为字段名.keyword,这是es这边的查询规则,需要你们提前学习一下。框架能发展到今天,这种基础功能肯定是没有问题的,已经被测了无数侧并且很多公司上了生产验证过了,要连个简单的eq都不能正常运作的话,这个框架可以废弃了。
更多这种基础知识的学习不妨看下官网避坑指南,以免掉入某些ES的坑里。

@xpc1024 xpc1024 closed this as completed Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants