[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:
parent
27a313c07d
commit
c0a6b6741e
|
@ -13,6 +13,7 @@ import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||||
import org.elasticsearch.index.query.QueryBuilder;
|
import org.elasticsearch.index.query.QueryBuilder;
|
||||||
import org.elasticsearch.index.query.RangeQueryBuilder;
|
import org.elasticsearch.index.query.RangeQueryBuilder;
|
||||||
import org.elasticsearch.rest.RestStatus;
|
import org.elasticsearch.rest.RestStatus;
|
||||||
|
import org.elasticsearch.xpack.ml.utils.ExceptionsHelper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -46,7 +47,7 @@ public final class ExtractorUtils {
|
||||||
ShardSearchFailure[] shardFailures = searchResponse.getShardFailures();
|
ShardSearchFailure[] shardFailures = searchResponse.getShardFailures();
|
||||||
if (shardFailures != null && shardFailures.length > 0) {
|
if (shardFailures != null && shardFailures.length > 0) {
|
||||||
LOGGER.error("[{}] Search request returned shard failures: {}", jobId, Arrays.toString(shardFailures));
|
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();
|
int unavailableShards = searchResponse.getTotalShards() - searchResponse.getSuccessfulShards();
|
||||||
if (unavailableShards > 0) {
|
if (unavailableShards > 0) {
|
||||||
|
|
Loading…
Reference in New Issue