spring-data-jest
spring-data-jest copied to clipboard
GetIndicesFromAlias Throws Exception When Alias Doesn't Exist
I'm trying to use getIndicesFromAlias and it's throwing a JestElasticSearchException when it can't find the index.
This is the code that throws.
public Set<String> getIndicesFromAlias(String aliasName) {
JestResult result = execute(new GetAliases.Builder().addIndex(aliasName).build());
if (!result.isSucceeded()) {
return Collections.emptySet();
}
It seems to me that it should be using the other execute and passing in acceptNotFound as true. So it should be:
JestResult result = execute(new GetAliases.Builder().addIndex(aliasName).build(), true);
Was wondering if this was the intended action, or should I be catching the 404 and dealing with it myself.
Thanks
Hi @nfratin , thanks for your feedback.
I will check that, I guess that it will be better with "acceptNotFound" enabled but I need to check the compatibility with many versions of ES.
Julien.