当前位置:网站首页>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
边栏推荐
猜你喜欢
在 4EVERLAND 上存储 WordPress 媒体内容,完成去中心化存储
[solved] unknown error 1146
Map interface and method
Summary of Arduino serial functions related to print read
JS monitors empty objects and empty references
Common problems in io streams
Margin left: -100% understanding in the Grail layout
不出网上线CS的各种姿势
4279. Cartesian tree
High concurrency memory pool
随机推荐
4everland: the Web3 Developer Center on IPFs has deployed more than 30000 dapps!
Discussion on some problems of array
twenty million two hundred and twenty thousand three hundred and nineteen
3311. Longest arithmetic
Jeecg menu path display problem
Vertx multi vertical shared data
The concept of C language pointer
An overview of IfM Engage
Talk about floating
Raspberry pie update tool chain
4EVERLAND:IPFS 上的 Web3 开发者中心,部署了超过 30,000 个 Dapp!
TCP cumulative acknowledgement and window value update
为什么说数据服务化是下一代数据中台的方向?
《指环王:力量之戒》新剧照 力量之戒铸造者亮相
Recursion, Fibonacci sequence
List exercises after class
The difference between typescript let and VaR
Lombok cooperates with @slf4j and logback to realize logging
TypeScript let與var的區別
Vertx restful style web router