Improve error message when the cluster has no indices
When the indices are empty, replaced the error message `IndexMissingException[[[]] missing]` with `IndexMissingException[[[_all]] missing]` Closes elastic/elasticsearch#138 Original commit: elastic/x-pack-elasticsearch@b590547722
This commit is contained in:
parent
7f77627396
commit
c20e4efe2d
|
@ -71,6 +71,9 @@ public class DefaultIndicesResolver implements IndicesResolver<TransportRequest>
|
||||||
//If we can't replace because we got an empty set, we can only throw exception.
|
//If we can't replace because we got an empty set, we can only throw exception.
|
||||||
//Downside of this is that a single item exception is going to its composite requests fail as a whole.
|
//Downside of this is that a single item exception is going to its composite requests fail as a whole.
|
||||||
if (indices == null || indices.isEmpty()) {
|
if (indices == null || indices.isEmpty()) {
|
||||||
|
if (MetaData.isAllIndices(indicesRequest.indices())) {
|
||||||
|
throw new IndexMissingException(new Index(MetaData.ALL));
|
||||||
|
}
|
||||||
throw new IndexMissingException(new Index(Arrays.toString(indicesRequest.indices())));
|
throw new IndexMissingException(new Index(Arrays.toString(indicesRequest.indices())));
|
||||||
}
|
}
|
||||||
((IndicesRequest.Replaceable)indicesRequest).indices(indices.toArray(new String[indices.size()]));
|
((IndicesRequest.Replaceable)indicesRequest).indices(indices.toArray(new String[indices.size()]));
|
||||||
|
|
Loading…
Reference in New Issue