当前位置:网站首页>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
边栏推荐
- Common architectures of IO streams
- Sent by mqtt client server of vertx
- JUnit unit test of vertx
- sharepoint 2007 versions
- The babbage industrial policy forum
- Final, override, polymorphism, abstraction, interface
- Hash table, generic
- IPv4 address
- Homology policy / cross domain and cross domain solutions /web security attacks CSRF and XSS
- Common analysis with criteria method
猜你喜欢

File operation serialization recursive copy

TreeMap

Custom generic structure
![[coppeliasim4.3] C calls UR5 in the remoteapi control scenario](/img/ca/2f72ea3590c358a6c9884aaa1a1c33.png)
[coppeliasim4.3] C calls UR5 in the remoteapi control scenario

Various postures of CS without online line

Common problems in io streams
![[solved] unknown error 1146](/img/f1/b8dd3ca8359ac9eb19e1911bd3790a.png)
[solved] unknown error 1146

图像识别与检测--笔记

URL programming

Summary of Arduino serial functions related to print read
随机推荐
Dora (discover offer request recognition) process of obtaining IP address
Interview questions about producers and consumers (important)
Common analysis with criteria method
I. D3.js hello world
Vertx's responsive MySQL template
2021-07-18
Common operations of JSP
An overview of IfM Engage
Longest common prefix and
Hash table, generic
gstreamer ffmpeg avdec解码数据流向分析
TreeMap
Topic | synchronous asynchronous
Warehouse database fields_ Summary of SQL problems in kingbase8 migration of Jincang database
[solved] win10 cannot find a solution to the local group policy editor
Use of other streams
Web router of vertx
20220319
Lombok -- simplify code
docket
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