@@ -58,6 +58,7 @@ public final class QueryInsightsListener extends SearchRequestOperationsListener
58
58
private final ClusterService clusterService ;
59
59
private boolean groupingFieldNameEnabled ;
60
60
private boolean groupingFieldTypeEnabled ;
61
+ private final QueryShapeGenerator queryShapeGenerator ;
61
62
62
63
/**
63
64
* Constructor for QueryInsightsListener
@@ -87,6 +88,7 @@ public QueryInsightsListener(
87
88
super (initiallyEnabled );
88
89
this .clusterService = clusterService ;
89
90
this .queryInsightsService = queryInsightsService ;
91
+ this .queryShapeGenerator = new QueryShapeGenerator (clusterService );
90
92
91
93
// Setting endpoints set up for top n queries, including enabling top n queries, window size, and top n size
92
94
// Expected metricTypes are Latency, CPU, and Memory.
@@ -271,7 +273,12 @@ private void constructSearchQueryRecord(final SearchPhaseContext context, final
271
273
attributes .put (Attribute .TASK_RESOURCE_USAGES , tasksResourceUsages );
272
274
273
275
if (queryInsightsService .isGroupingEnabled ()) {
274
- String hashcode = QueryShapeGenerator .getShapeHashCodeAsString (request .source (), groupingFieldNameEnabled );
276
+ String hashcode = queryShapeGenerator .getShapeHashCodeAsString (
277
+ request .source (),
278
+ groupingFieldNameEnabled ,
279
+ groupingFieldTypeEnabled ,
280
+ searchRequestContext .getSuccessfulSearchShardIndices ()
281
+ );
275
282
attributes .put (Attribute .QUERY_HASHCODE , hashcode );
276
283
}
277
284
0 commit comments