当前位置:网站首页>Collector in ES (percentile / base)
Collector in ES (percentile / base)
2022-07-03 07:30:00 【chuanyangwang】
org.elasticsearch.search.query.QueryPhase#executeInternal
final LinkedList<QueryCollectorContext> collectors = new LinkedList<>();
// whether the chain contains a collector that filters documents
boolean hasFilterCollector = false;
if (searchContext.terminateAfter() != SearchContext.DEFAULT_TERMINATE_AFTER) {
// add terminate_after before the filter collectors
// it will only be applied on documents accepted by these filter collectors
collectors.add(createEarlyTerminationCollectorContext(searchContext.terminateAfter()));
// this collector can filter documents during the collection
hasFilterCollector = true;
}
if (searchContext.parsedPostFilter() != null) {
// add post filters before aggregations
// it will only be applied to top hits
collectors.add(createFilteredCollectorContext(searcher, searchContext.parsedPostFilter().query()));
// this collector can filter documents during the collection
hasFilterCollector = true;
}
if (searchContext.queryCollectors().isEmpty() == false) {
// plug in additional collectors, like aggregations
collectors.add(createMultiCollectorContext(searchContext.queryCollectors().values()));
}
if (searchContext.minimumScore() != null) {
// apply the minimum score after multi collector so we filter aggs as well
collectors.add(createMinScoreCollectorContext(searchContext.minimumScore()));
// this collector can filter documents during the collection
hasFilterCollector = true;
}org.elasticsearch.search.query.QueryPhase#searchWithCollector
// create the top docs collector last when the other collectors are known
final TopDocsCollectorContext topDocsFactory = createTopDocsCollectorContext(searchContext, hasFilterCollector);
// add the top docs collector, the first collector context in the chain
collectors.addFirst(topDocsFactory);{
"min_score": 10,
"query": {
"bool": {
"must": [
{
"term": {
"speaker": "HOTSPUR"
}
}
]
}
},
"post_filter": {
"term": {
"speaker": "HOTSPUR"
}
},
"aggs": {
"all_colors": {
"terms": {
"field": "speaker",
"size": 200
}
}
}
}
/**
* Creates the collector tree from the provided <code>collectors</code>
* @param collectors Ordered list of collector context
*/
static Collector createQueryCollector(List<QueryCollectorContext> collectors) throws IOException {
Collector collector = null;
for (QueryCollectorContext ctx : collectors) {
collector = ctx.create(collector);
}
return collector;
}Converted tree structure

Percentile / base The principle can be referred to the document
边栏推荐
- Jeecg request URL signature
- IO stream system and FileReader, filewriter
- Docker builds MySQL: the specified path of version 5.7 cannot be mounted.
- 【无标题】
- Mail sending of vertx
- LeetCode
- Basic knowledge about SQL database
- JUnit unit test of vertx
- 7.2 brush two questions
- Chrome 98 Private Network Access problem w/ disabled web security: Request had no target IP address
猜你喜欢

New stills of Lord of the rings: the ring of strength: the caster of the ring of strength appears

昇思MindSpore再升级,深度科学计算的极致创新

Recursion, Fibonacci sequence

Final, override, polymorphism, abstraction, interface

VMware network mode - bridge, host only, NAT network

【CoppeliaSim4.3】C#调用 remoteApi控制场景中UR5
![[solved] unknown error 1146](/img/f1/b8dd3ca8359ac9eb19e1911bd3790a.png)
[solved] unknown error 1146

为什么说数据服务化是下一代数据中台的方向?

TCP cumulative acknowledgement and window value update

C代码生产YUV420 planar格式文件
随机推荐
C代码生产YUV420 planar格式文件
【已解决】SQLException: Invalid value for getInt() - ‘田鹏‘
[most detailed] latest and complete redis interview book (50)
Some basic operations of reflection
7.2 brush two questions
Chrome 98 Private Network Access problem w/ disabled web security: Request had no target IP address
Understanding of class
Lombok -- simplify code
Jeecg request URL signature
Leetcode 213: looting II
昇思MindSpore再升级,深度科学计算的极致创新
树莓派更新工具链
Introduction of buffer flow
VMware network mode - bridge, host only, NAT network
Realize the reuse of components with different routing parameters and monitor the changes of routing parameters
Leetcode 213: 打家劫舍 II
"Moss ma not found" solution
《指環王:力量之戒》新劇照 力量之戒鑄造者亮相
Vertx multi vertical shared data
【已解决】Unknown error 1146
https://zhuanlan.zhihu.com/p/58519480
https://www.elastic.co/guide/cn/elasticsearch/guide/current/cardinality.html
https://www.bilibili.com/video/BV1SK4y1V7EG?from=search&seid=14672124501694792763&spm_id_from=333.337.0.0