[ML] Improve notification message for shard failures in datafeed

relates elastic/x-pack-elasticsearch#804

Original commit: elastic/x-pack-elasticsearch@2114f94937
This commit is contained in:
Dimitrios Athanasiou 2017-03-27 13:28:15 +01:00
parent 27a313c07d
commit c0a6b6741e
1 changed files with 2 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.RangeQueryBuilder;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.xpack.ml.utils.ExceptionsHelper;
import java.io.IOException;
import java.util.Arrays;
@ -46,7 +47,7 @@ public final class ExtractorUtils {
ShardSearchFailure[] shardFailures = searchResponse.getShardFailures();
if (shardFailures != null && shardFailures.length > 0) {
LOGGER.error("[{}] Search request returned shard failures: {}", jobId, Arrays.toString(shardFailures));
throw new IOException("[" + jobId + "] Search request returned shard failures; see more info in the logs");
throw new IOException(ExceptionsHelper.shardFailuresToErrorMsg(jobId, shardFailures));
}
int unavailableShards = searchResponse.getTotalShards() - searchResponse.getSuccessfulShards();
if (unavailableShards > 0) {