From c20e4efe2dd5e9676f801e0015990f3acb971f7f Mon Sep 17 00:00:00 2001 From: javanna Date: Thu, 9 Oct 2014 16:32:01 +0200 Subject: [PATCH] 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@b5905477221bc0920de8568d437c90deb6e561e3 --- .../shield/authz/indicesresolver/DefaultIndicesResolver.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/org/elasticsearch/shield/authz/indicesresolver/DefaultIndicesResolver.java b/src/main/java/org/elasticsearch/shield/authz/indicesresolver/DefaultIndicesResolver.java index 5ba0d23b931..af2c8ac001c 100644 --- a/src/main/java/org/elasticsearch/shield/authz/indicesresolver/DefaultIndicesResolver.java +++ b/src/main/java/org/elasticsearch/shield/authz/indicesresolver/DefaultIndicesResolver.java @@ -71,6 +71,9 @@ public class DefaultIndicesResolver implements IndicesResolver //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. 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()))); } ((IndicesRequest.Replaceable)indicesRequest).indices(indices.toArray(new String[indices.size()]));