@@ -142,6 +142,7 @@ public static class Stats implements Writeable, ToXContentFragment {
142142 private long queryCount ;
143143 private long queryTimeInMillis ;
144144 private long queryCurrent ;
145+ private long queryFailedCount ;
145146
146147 private long concurrentQueryCount ;
147148 private long concurrentQueryTimeInMillis ;
@@ -169,6 +170,7 @@ public static class Stats implements Writeable, ToXContentFragment {
169170 private long starTreeQueryCount ;
170171 private long starTreeQueryTimeInMillis ;
171172 private long starTreeQueryCurrent ;
173+ private long starTreeQueryFailed ;
172174
173175 @ Nullable
174176 private RequestStatsLongHolder requestStatsLongHolder ;
@@ -191,6 +193,7 @@ private Stats(Builder builder) {
191193 this .queryCount = builder .queryCount ;
192194 this .queryTimeInMillis = builder .queryTimeInMillis ;
193195 this .queryCurrent = builder .queryCurrent ;
196+ this .queryFailedCount = builder .queryFailedCount ;
194197
195198 this .concurrentQueryCount = builder .concurrentQueryCount ;
196199 this .concurrentQueryTimeInMillis = builder .concurrentQueryTimeInMillis ;
@@ -218,6 +221,7 @@ private Stats(Builder builder) {
218221 this .starTreeQueryCount = builder .starTreeQueryCount ;
219222 this .starTreeQueryTimeInMillis = builder .starTreeQueryTimeInMillis ;
220223 this .starTreeQueryCurrent = builder .starTreeQueryCurrent ;
224+ this .starTreeQueryFailed = builder .starTreeQueryFailed ;
221225 }
222226
223227 /**
@@ -319,12 +323,18 @@ private Stats(StreamInput in) throws IOException {
319323 starTreeQueryTimeInMillis = in .readVLong ();
320324 starTreeQueryCurrent = in .readVLong ();
321325 }
326+
327+ if (in .getVersion ().onOrAfter (Version .V_3_3_0 )) {
328+ queryFailedCount = in .readVLong ();
329+ starTreeQueryFailed = in .readVLong ();
330+ }
322331 }
323332
324333 public void add (Stats stats ) {
325334 queryCount += stats .queryCount ;
326335 queryTimeInMillis += stats .queryTimeInMillis ;
327336 queryCurrent += stats .queryCurrent ;
337+ queryFailedCount += stats .queryFailedCount ;
328338
329339 concurrentQueryCount += stats .concurrentQueryCount ;
330340 concurrentQueryTimeInMillis += stats .concurrentQueryTimeInMillis ;
@@ -352,11 +362,13 @@ public void add(Stats stats) {
352362 starTreeQueryCount += stats .starTreeQueryCount ;
353363 starTreeQueryTimeInMillis += stats .starTreeQueryTimeInMillis ;
354364 starTreeQueryCurrent += stats .starTreeQueryCurrent ;
365+ starTreeQueryFailed += stats .starTreeQueryFailed ;
355366 }
356367
357368 public void addForClosingShard (Stats stats ) {
358369 queryCount += stats .queryCount ;
359370 queryTimeInMillis += stats .queryTimeInMillis ;
371+ queryFailedCount += stats .queryFailedCount ;
360372
361373 concurrentQueryCount += stats .concurrentQueryCount ;
362374 concurrentQueryTimeInMillis += stats .concurrentQueryTimeInMillis ;
@@ -381,6 +393,7 @@ public void addForClosingShard(Stats stats) {
381393
382394 starTreeQueryCount += stats .starTreeQueryCount ;
383395 starTreeQueryTimeInMillis += stats .starTreeQueryTimeInMillis ;
396+ starTreeQueryFailed += stats .starTreeQueryFailed ;
384397 }
385398
386399 public long getQueryCount () {
@@ -399,6 +412,10 @@ public long getQueryCurrent() {
399412 return queryCurrent ;
400413 }
401414
415+ public long getQueryFailedCount () {
416+ return queryFailedCount ;
417+ }
418+
402419 public long getConcurrentQueryCount () {
403420 return concurrentQueryCount ;
404421 }
@@ -507,6 +524,10 @@ public long getStarTreeQueryCurrent() {
507524 return starTreeQueryCurrent ;
508525 }
509526
527+ public long getStarTreeQueryFailed () {
528+ return starTreeQueryFailed ;
529+ }
530+
510531 public static Stats readStats (StreamInput in ) throws IOException {
511532 return new Stats (in );
512533 }
@@ -562,13 +583,19 @@ public void writeTo(StreamOutput out) throws IOException {
562583 out .writeVLong (starTreeQueryTimeInMillis );
563584 out .writeVLong (starTreeQueryCurrent );
564585 }
586+
587+ if (out .getVersion ().onOrAfter (Version .V_3_3_0 )) {
588+ out .writeVLong (queryFailedCount );
589+ out .writeVLong (starTreeQueryFailed );
590+ }
565591 }
566592
567593 @ Override
568594 public XContentBuilder toXContent (XContentBuilder builder , Params params ) throws IOException {
569595 builder .field (Fields .QUERY_TOTAL , queryCount );
570596 builder .humanReadableField (Fields .QUERY_TIME_IN_MILLIS , Fields .QUERY_TIME , getQueryTime ());
571597 builder .field (Fields .QUERY_CURRENT , queryCurrent );
598+ builder .field (Fields .QUERY_FAILED_TOTAL , queryFailedCount );
572599
573600 builder .field (Fields .CONCURRENT_QUERY_TOTAL , concurrentQueryCount );
574601 builder .humanReadableField (Fields .CONCURRENT_QUERY_TIME_IN_MILLIS , Fields .CONCURRENT_QUERY_TIME , getConcurrentQueryTime ());
@@ -578,6 +605,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
578605 builder .field (Fields .STARTREE_QUERY_TOTAL , starTreeQueryCount );
579606 builder .humanReadableField (Fields .STARTREE_QUERY_TIME_IN_MILLIS , Fields .STARTREE_QUERY_TIME , getStarTreeQueryTime ());
580607 builder .field (Fields .STARTREE_QUERY_CURRENT , getStarTreeQueryCurrent ());
608+ builder .field (Fields .STARTREE_QUERY_FAILED , getStarTreeQueryFailed ());
581609
582610 builder .field (Fields .FETCH_TOTAL , fetchCount );
583611 builder .humanReadableField (Fields .FETCH_TIME_IN_MILLIS , Fields .FETCH_TIME , getFetchTime ());
@@ -633,6 +661,7 @@ public static class Builder {
633661 private long queryCount = 0 ;
634662 private long queryTimeInMillis = 0 ;
635663 private long queryCurrent = 0 ;
664+ private long queryFailedCount = 0 ;
636665 private long concurrentQueryCount = 0 ;
637666 private long concurrentQueryTimeInMillis = 0 ;
638667 private long concurrentQueryCurrent = 0 ;
@@ -653,6 +682,7 @@ public static class Builder {
653682 private long starTreeQueryCount = 0 ;
654683 private long starTreeQueryTimeInMillis = 0 ;
655684 private long starTreeQueryCurrent = 0 ;
685+ private long starTreeQueryFailed = 0 ;
656686 @ Nullable
657687 private RequestStatsLongHolder requestStatsLongHolder = null ;
658688
@@ -673,6 +703,11 @@ public Builder queryCurrent(long current) {
673703 return this ;
674704 }
675705
706+ public Builder queryFailed (long count ) {
707+ this .queryFailedCount = count ;
708+ return this ;
709+ }
710+
676711 public Builder concurrentQueryCount (long count ) {
677712 this .concurrentQueryCount = count ;
678713 return this ;
@@ -773,6 +808,11 @@ public Builder starTreeQueryCurrent(long current) {
773808 return this ;
774809 }
775810
811+ public Builder starTreeQueryFailed (long count ) {
812+ this .starTreeQueryFailed = count ;
813+ return this ;
814+ }
815+
776816 /**
777817 * Creates a {@link Stats} object from the builder's current state.
778818 * @return A new Stats instance.
@@ -916,6 +956,7 @@ static final class Fields {
916956 static final String QUERY_TIME = "query_time" ;
917957 static final String QUERY_TIME_IN_MILLIS = "query_time_in_millis" ;
918958 static final String QUERY_CURRENT = "query_current" ;
959+ static final String QUERY_FAILED_TOTAL = "query_failed" ;
919960 static final String CONCURRENT_QUERY_TOTAL = "concurrent_query_total" ;
920961 static final String CONCURRENT_QUERY_TIME = "concurrent_query_time" ;
921962 static final String CONCURRENT_QUERY_TIME_IN_MILLIS = "concurrent_query_time_in_millis" ;
@@ -925,6 +966,7 @@ static final class Fields {
925966 static final String STARTREE_QUERY_TIME = "startree_query_time" ;
926967 static final String STARTREE_QUERY_TIME_IN_MILLIS = "startree_query_time_in_millis" ;
927968 static final String STARTREE_QUERY_CURRENT = "startree_query_current" ;
969+ static final String STARTREE_QUERY_FAILED = "startree_query_failed" ;
928970 static final String FETCH_TOTAL = "fetch_total" ;
929971 static final String FETCH_TIME = "fetch_time" ;
930972 static final String FETCH_TIME_IN_MILLIS = "fetch_time_in_millis" ;
0 commit comments