diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/manager/AutodetectProcessManager.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/manager/AutodetectProcessManager.java index a59ae0f0661..717bdf20c67 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/manager/AutodetectProcessManager.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/manager/AutodetectProcessManager.java @@ -123,7 +123,7 @@ public class AutodetectProcessManager extends AbstractComponent implements DataP AutodetectCommunicator create(String jobId, boolean ignoreDowntime) { if (autoDetectCommunicatorByJob.size() == maxRunningJobs) { throw new ElasticsearchStatusException("max running job capacity [" + maxRunningJobs + "] reached", - RestStatus.TOO_MANY_REQUESTS); + RestStatus.FORBIDDEN); } // TODO norelease, once we remove black hole process diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/integration/TooManyJobsIT.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/integration/TooManyJobsIT.java index f72d6e0fb6a..52f952ecaf5 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/integration/TooManyJobsIT.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/prelert/integration/TooManyJobsIT.java @@ -81,7 +81,7 @@ public class TooManyJobsIT extends ESIntegTestCase { logger.warn("Unexpected cause", e); } assertEquals(ElasticsearchStatusException.class, cause.getClass()); - assertEquals(RestStatus.TOO_MANY_REQUESTS, ((ElasticsearchStatusException) cause).status()); + assertEquals(RestStatus.FORBIDDEN, ((ElasticsearchStatusException) cause).status()); logger.info("good news everybody --> reached threadpool capacity after starting {}th analytical process", i); // now manually clean things up and see if we can succeed to start one new job