throw index already exists failure when it exists as alias on creation
make sure to throw the already exists exception, so when indexing into an alias, and it has not propagated yet through the cluster state, it will end up being ignored if it already exists
This commit is contained in:
parent
ed39e79d8f
commit
8a62619fb9
|
@ -506,7 +506,7 @@ public class MetaDataCreateIndexService extends AbstractComponent {
|
|||
throw new InvalidIndexNameException(new Index(request.index), request.index, "must not contain the following characters " + Strings.INVALID_FILENAME_CHARS);
|
||||
}
|
||||
if (state.metaData().aliases().containsKey(request.index)) {
|
||||
throw new InvalidIndexNameException(new Index(request.index), request.index, "an alias with the same name already exists");
|
||||
throw new IndexAlreadyExistsException(new Index(request.index), "already exists as alias");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,11 @@ import org.elasticsearch.rest.RestStatus;
|
|||
public class IndexAlreadyExistsException extends IndexException {
|
||||
|
||||
public IndexAlreadyExistsException(Index index) {
|
||||
super(index, "Already exists");
|
||||
this(index, "already exists");
|
||||
}
|
||||
|
||||
public IndexAlreadyExistsException(Index index, String message) {
|
||||
super(index, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue