From 46fcd07153617be145c1b7434e849afc694d640e Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Tue, 13 Mar 2018 20:40:47 -0400 Subject: [PATCH] Add total hits to the search slow log (#29034) This commit adds the total hits to the search slow log. --- .../main/java/org/elasticsearch/index/SearchSlowLog.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/index/SearchSlowLog.java b/server/src/main/java/org/elasticsearch/index/SearchSlowLog.java index a48e3d7bd72..f3c5d07f1f2 100644 --- a/server/src/main/java/org/elasticsearch/index/SearchSlowLog.java +++ b/server/src/main/java/org/elasticsearch/index/SearchSlowLog.java @@ -149,8 +149,11 @@ public final class SearchSlowLog implements SearchOperationListener { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append(context.indexShard().shardId()).append(" "); - sb.append("took[").append(TimeValue.timeValueNanos(tookInNanos)).append("], took_millis[").append(TimeUnit.NANOSECONDS.toMillis(tookInNanos)).append("], "); + sb.append(context.indexShard().shardId()) + .append(" ") + .append("took[").append(TimeValue.timeValueNanos(tookInNanos)).append("], ") + .append("took_millis[").append(TimeUnit.NANOSECONDS.toMillis(tookInNanos)).append("], ") + .append("total_hits[").append(context.queryResult().getTotalHits()).append("], "); if (context.getQueryShardContext().getTypes() == null) { sb.append("types[], "); } else {