You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/04/27 12:07:35 UTC

[GitHub] [skywalking] chenhaipeng commented on a diff in pull request #8959: Improve the performance of TermsAggregation

chenhaipeng commented on code in PR #8959:
URL: https://github.com/apache/skywalking/pull/8959#discussion_r859712662


##########
oap-server/server-library/library-elasticsearch-client/src/main/java/org/apache/skywalking/library/elasticsearch/requests/search/aggregation/TermsAggregation.java:
##########
@@ -58,6 +58,8 @@ public void serialize(final TermsAggregation value, final JsonGenerator gen,
                     if (value.getOrder() != null) {
                         writeOrder(value, gen);
                     }
+                    gen.writeStringField("execution_hint", "map");
+                    gen.writeStringField("collect_mode", "breadth_first");

Review Comment:
   please see here https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-aggregations-bucket-terms-aggregation.html#CO114-1
   
   
   Because the metrics data is relatively small, using breadth_first, and execution_hint map will have a huge query improvement。
   
   I did a simple test
   When the index data is empty, "execution_hint" is not added, "map" took 30209ms, and the query timeout
   
   When adding "execution_hint ""map" took 556ms
   
   There are also similar question by other https://stackoverflow.com/questions/50893653/elasticsearch-slow-terms-aggregation/50895792#50895792



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org