ES bool查询

一、bool查询包含四种操作

1.must

2.must not

3.filter

4.should

 

 

 二、功能

1.must 对应mysql的 and a=

2.must not 对应mysql的 and a!=

3.filter 对应mysql的 and a=

4.should 对应mysql的 or a=

 

三、must和filter比较

1.must算分,filter不算分

2.filter效率比must高

 

四、filter效率高的原理

1.query context:文档更加匹配查询条件,分数越高越匹配

2.filter context:文档是否匹配查询条件,并且ES会缓存查询结果

 

 

 

 

 

 

 

参考:

https://blog.csdn.net/pony_maggie/article/details/106062284

 

posted @ 2022-03-28 11:36  牧云文仔  阅读(782)  评论(0编辑  收藏  举报