log ResourceAlreadyExistsException differently,

it can happen we encounter more then one cluster states with no usage index and causing this class to send two or more create index requests, but only one request will succeed.

Original commit: elastic/x-pack-elasticsearch@524a1dda61
This commit is contained in:
Martijn van Groningen 2016-11-29 10:20:48 +01:00
parent 0cba57194c
commit 78cd60048c
1 changed files with 6 additions and 1 deletions

View File

@ -5,6 +5,7 @@
*/
package org.elasticsearch.xpack.prelert.job.metadata;
import org.elasticsearch.ResourceAlreadyExistsException;
import org.elasticsearch.cluster.ClusterChangedEvent;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.ClusterStateListener;
@ -60,7 +61,11 @@ public class PrelertInitializationService extends AbstractComponent implements C
if (result) {
logger.info("successfully created prelert-usage index");
} else {
logger.error("not able to create prelert-usage index", error);
if (error instanceof ResourceAlreadyExistsException) {
logger.debug("not able to create prelert-usage index", error);
} else {
logger.error("not able to create prelert-usage index", error);
}
}
});
});