### Description

This applies to the following APIs:
- [x] open anomaly detection
- [x] start datafeed
- [x] start data frame analytics job
- [x] start trained model deployment

Currently, if the operation takes longer than the configured `timeout`, the response status code is `500`.

With Kibana in mind, a `4xx` response would be more suitable as it will lead to showing more useful information to the user about why the request failed.

Looking at [RFC 9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-408-request-timeout), it seems the most appropriate `4xx` code would be `408 Request Timeout`, even though the RFC describes a different situation. 

The alternative, `504 Gateway Timeout`, would be more appropriate for this situation but it wouldn't improve the user experience in Kibana.
x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java
jobBuilder.setDataDescription(dataDescription);
        putJob(jobBuilder);
        openJob(jobBuilder.getId());
        assertBusy(() -> assertEquals(getJobStats(jobBuilder.getId()).get(0).getState(), JobState.OPENED));
        DatafeedConfig.Builder dfBuilder = new DatafeedConfig.Builder(jobBuilder.getId() + "-datafeed", jobBuilder.getId());
        dfBuilder.setQueryDelay(TimeValue.timeValueSeconds(1));
        dfBuilder.setFrequency(TimeValue.timeValueSeconds(1));
        dfBuilder.setIndices(Collections.singletonList("data-1"));
        Map<String, Object> properties = new HashMap<>();
        properties.put("type", "long");
        properties.put("script", "emit(doc['time'].value.getDayOfWeekEnum().value)");
        Map<String, Object> fields = new HashMap<>();
        fields.put("day_of_week", properties);
        dfBuilder.setRuntimeMappings(fields);
        DatafeedConfig datafeedConfig = dfBuilder.build();
        putDatafeed(datafeedConfig);
        startDatafeed(datafeedConfig.getId(), 0L, now);
        assertBusy(() -> {
            DataCounts dataCounts = getDataCounts(jobBuilder.getId());
            assertThat(dataCounts.getProcessedRecordCount(), equalTo(numDocs));
            assertThat(dataCounts.getOutOfOrderTimeStampCount(), equalTo(0L));
            assertThat(dataCounts.getMissingFieldCount(), equalTo(0L));
            GetDatafeedsStatsAction.Request request = new GetDatafeedsStatsAction.Request(datafeedConfig.getId());
            GetDatafeedsStatsAction.Response response = client().execute(GetDatafeedsStatsAction.INSTANCE, request).actionGet();
            assertThat(response.getResponse().results().get(0).getDatafeedState(), equalTo(DatafeedState.STOPPED));
        }, 60, TimeUnit.SECONDS);
        waitUntilJobIsClosed(jobBuilder.getId());
    }
    @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/63973")
    public void testDatafeedTimingStats_DatafeedRecreated() throws Exception {