当前位置:网站首页>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
边栏推荐
- Homology policy / cross domain and cross domain solutions /web security attacks CSRF and XSS
- Use of generics
- 【CMake】CMake链接SQLite库
- The babbage industrial policy forum
- 【已解决】win10找不到本地组策略编辑器解决方法
- Summary of Arduino serial functions related to print read
- [set theory] Stirling subset number (Stirling subset number concept | ball model | Stirling subset number recurrence formula | binary relationship refinement relationship of division)
- "Moss ma not found" solution
- TreeMap
- [coppeliasim4.3] C calls UR5 in the remoteapi control scenario
猜你喜欢
随机推荐
SQL create temporary table
Hisat2 - stringtie - deseq2 pipeline for bulk RNA seq
圖像識別與檢測--筆記
Jeecg menu path display problem
Le Seigneur des anneaux: l'anneau du pouvoir
《指環王:力量之戒》新劇照 力量之戒鑄造者亮相
New stills of Lord of the rings: the ring of strength: the caster of the ring of strength appears
Take you through the whole process and comprehensively understand the software accidents that belong to testing
Summary of abnormal mechanism of interview
Wireshark software usage
Leetcode 213: 打家劫舍 II
URL programming
C code production YUV420 planar format file
Topic | synchronous asynchronous
VMWare网络模式-桥接,Host-Only,NAT网络
Arduino Serial系列函数 有关print read 的总结
II. D3.js draw a simple figure -- circle
Industrial resilience
docker建立mysql:5.7版本指定路径挂载不上。
不出网上线CS的各种姿势