Skip to content

[ML] Delete Forecast : REST JSON inconsistency #39673

@codebrain

Description

@codebrain

The documentation (https://www.elastic.co/guide/en/elasticsearch/reference/6.5/ml-delete-forecast.html) indicates that <forecast_id> is optional, and the REST JSON specification indicates this too (

).

The issue is, however, is that the RestDeleteForecastAction registration only registers URLs that contain the <forecastid> parameter (

public RestDeleteForecastAction(Settings settings, RestController controller) {
).

The .NET client, when calling a URL without the <forecastid> defaults to a DELETE verb on _xpack/ml/anomaly_detectors/<job_id>/_forecast. The server then responds with a 405 error and that the endpoint accepts a POST - at this point the server likely assumes this request was intended to post a record - albeit an incorrect assumption.

In the meantime I have patched the REST JSON spec locally to make <forecastid> a required field and everything then works as expected: https://github.com/elastic/elasticsearch-net/blob/4aa8ad121cd4830afe98f1dbcdcc3790fd2e291d/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.delete_forecast.patch.json


Can a fix be considered along the lines of:

  • Register correct REST endpoint url for DELETE action.
    or
  • Make <forecastid> required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    :mlMachine learning

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions