@@ -248,10 +248,8 @@ public Map<String, Cluster> getClusters() {
248248 public Cluster swapCluster (String clusterAlias , BiFunction <String , Cluster , Cluster > remappingFunction ) {
249249 return clusterInfo .compute (clusterAlias , (unused , oldCluster ) -> {
250250 final Cluster newCluster = remappingFunction .apply (clusterAlias , oldCluster );
251- if (isPartial == false ) {
252- isPartial = newCluster .getStatus () == Cluster .Status .PARTIAL
253- || newCluster .getStatus () == Cluster .Status .SKIPPED
254- || (newCluster .failedShards != null && newCluster .failedShards > 0 );
251+ if (newCluster != null && isPartial == false ) {
252+ isPartial = newCluster .isPartial ();
255253 }
256254 return newCluster ;
257255 });
@@ -313,13 +311,6 @@ public boolean isPartial() {
313311 return isPartial ;
314312 }
315313
316- /**
317- * Mark the query as having partial results.
318- */
319- public void markAsPartial () {
320- isPartial = true ;
321- }
322-
323314 public void markAsStopped () {
324315 isStopped = true ;
325316 }
@@ -328,13 +319,6 @@ public boolean isStopped() {
328319 return isStopped ;
329320 }
330321
331- /**
332- * Mark this cluster as having partial results.
333- */
334- public void markClusterAsPartial (String clusterAlias ) {
335- swapCluster (clusterAlias , (k , v ) -> new Cluster .Builder (v ).setStatus (Cluster .Status .PARTIAL ).build ());
336- }
337-
338322 /**
339323 * Represents the search metadata about a particular cluster involved in a cross-cluster search.
340324 * The Cluster object can represent either the local cluster or a remote cluster.
@@ -626,6 +610,10 @@ public List<ShardSearchFailure> getFailures() {
626610 return failures ;
627611 }
628612
613+ boolean isPartial () {
614+ return status == Status .PARTIAL || status == Status .SKIPPED || (failedShards != null && failedShards > 0 );
615+ }
616+
629617 @ Override
630618 public boolean equals (Object o ) {
631619 if (this == o ) return true ;
0 commit comments