Skip to content

Commit 0afb70a

Browse files
committed
Address review comments
Signed-off-by: Siddhant Deshmukh <deshsid@amazon.com>
1 parent aefb994 commit 0afb70a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/main/java/org/opensearch/plugin/insights/core/listener/QueryInsightsListener.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -262,19 +262,18 @@ private void constructSearchQueryRecord(final SearchPhaseContext context, final
262262
);
263263
}
264264

265-
String hashcode = "";
266-
if (queryInsightsService.isGroupingEnabled()) {
267-
hashcode = QueryShapeGenerator.getShapeHashCodeAsString(request.source(), groupingFieldNameEnabled);
268-
}
269-
270265
Map<Attribute, Object> attributes = new HashMap<>();
271266
attributes.put(Attribute.SEARCH_TYPE, request.searchType().toString().toLowerCase(Locale.ROOT));
272267
attributes.put(Attribute.SOURCE, request.source());
273268
attributes.put(Attribute.TOTAL_SHARDS, context.getNumShards());
274269
attributes.put(Attribute.INDICES, request.indices());
275270
attributes.put(Attribute.PHASE_LATENCY_MAP, searchRequestContext.phaseTookMap());
276271
attributes.put(Attribute.TASK_RESOURCE_USAGES, tasksResourceUsages);
277-
attributes.put(Attribute.QUERY_HASHCODE, hashcode);
272+
273+
if (queryInsightsService.isGroupingEnabled()) {
274+
String hashcode = QueryShapeGenerator.getShapeHashCodeAsString(request.source(), groupingFieldNameEnabled);
275+
attributes.put(Attribute.QUERY_HASHCODE, hashcode);
276+
}
278277

279278
Map<String, Object> labels = new HashMap<>();
280279
// Retrieve user provided label if exists

0 commit comments

Comments
 (0)