aderm commented on a change in pull request #4292: Improve ES query performance
URL: https://github.com/apache/skywalking/pull/4292#discussion_r372843173
##########
File path:
oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/AggregationQueryEsDAO.java
##########
@@ -96,7 +96,7 @@ public AggregationQueryEsDAO(ElasticSearchClient client) {
SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource();
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
- sourceBuilder.query(boolQueryBuilder);
+
sourceBuilder.query(QueryBuilders.boolQuery().filter(boolQueryBuilder));
boolQueryBuilder.must().add(QueryBuilders.rangeQuery(Metrics.TIME_BUCKET).lte(endTB).gte(startTB));
boolQueryBuilder.must().add(QueryBuilders.termQuery(EndpointInventory.SERVICE_ID,
serviceId));
Review comment:
The above statement, I feel a bit incomplete
refer this.
[https://www.elastic.co/guide/en/elasticsearch/reference/7.x/query-filter-context.html](url)
First,the search result process does not require scoring, which avoids the
process of calculation and sorting. Second, regarding the cache mechanism of
the filter, under what circumstances will the cache be used? This is still
under study. However, it should be sure at present that most of the ES queries
in SW should hit yes or no. They belong to the filter scene and do not need to
be scored, except of course for the scenes that are sorted.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services