博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
elasticsearch 中filter与post_filter的区别
阅读量:7080 次
发布时间:2019-06-28

本文共 1119 字,大约阅读时间需要 3 分钟。

hot3.png

As far as search hits are concerned, they are the same thing, i.e. the hits you get will be correctly filtered according to either your filter in a filtered query or the filter in your post_filter.

However, as far as aggregations are concerned, the end result will not be the same. The difference between both boils down to what document set the aggregations will be computed on.

If your filter is in a filtered query, then your aggregations will be computed on the document set selected by the query(ies) and the filter(s) in your filtered query, i.e. the same set of documents that you will get in the response.

If your filter is in a post_filter, then your aggregations will be computed on the document set selected by your various query(ies). Once aggregations have been computed on that document set, the latter is further filtered by the filter(s) in your post_filter before returning the matching documents.

To sum it up,

  • filtered query affects both search results and aggregations
  • while a post_filter only affects the search results but NOT the aggregations

转载于:https://my.oschina.net/duanvincent/blog/1799803

你可能感兴趣的文章
Visual Studio 2017 15.8第一个预览版发布,支持ARM64
查看>>
Homebrew 1.9发布,将支持Linux与Windows 10
查看>>
JavaScript学习笔记第三天_对象
查看>>
C++17标准制定完成
查看>>
没有JS的前端:体积更小、速度更快!
查看>>
OpenAI发布大型强化深度学习模拟器Neural MMO,AI适者生存择最优
查看>>
入门解读:小白也能看懂的容器和虚拟机介绍
查看>>
企业级区块链现状研究报告:小企业的投资总额是大企业的28倍
查看>>
php解析带有命名空间的xml
查看>>
在首次发布三周之后,MLflow迎来了0.2版本
查看>>
微软发布面向企业区块链网络的Coco Framework
查看>>
.NET Core中的去虚
查看>>
REST是否会步SOAP的后尘?
查看>>
微服务意味着分布式系统
查看>>
前端大神用React刻了一个Windows XP
查看>>
10种避免大型部署的方法
查看>>
Yelp的实时流技术之二:将MySQL表数据变更实时流到Kafka中
查看>>
数据不可变之linked-in/rocketdata
查看>>
Java 10新特性前瞻
查看>>
从蚂蚁金服实践入手,带你深入了解 Service Mesh
查看>>