File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -295,11 +295,15 @@ public Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params params
295295
296296 private Iterator <? extends ToXContent > onlyFailuresToXContent () {
297297 Iterator <Cluster > failuresIterator = clusterInfo .values ().stream ().filter (c -> (c .getFailures ().isEmpty () == false )).iterator ();
298- return Iterators .concat (
299- ChunkedToXContentHelper .startObject (),
300- ChunkedToXContentHelper .object ("details" , failuresIterator ),
301- ChunkedToXContentHelper .endObject ()
302- );
298+ if (failuresIterator .hasNext ()) {
299+ return Iterators .concat (
300+ ChunkedToXContentHelper .startObject (),
301+ ChunkedToXContentHelper .object ("details" , failuresIterator ),
302+ ChunkedToXContentHelper .endObject ()
303+ );
304+ } else {
305+ return Collections .emptyIterator ();
306+ }
303307 }
304308
305309 /**
You can’t perform that action at this time.
0 commit comments