Skip to content

Put Lifecycle method in ILM Client causes 400 Bad Request #160

Closed
@raynigon

Description

@raynigon

The PUT Lifecycle Endpoint send the name as a property in the body, which is not accepted by Elasticsearch.
This causes a 400 Bad Request Response.
Therefore this method is not usable.

Code

Application

client.ilm().putLifecycle(it -> {
    it.name(policy.name())
    it.policy(policy)
});

Request

Endpoint: PUT /_ilm/policy/{id}

{
  "policy": {
    "phases": {...},
    "name": "{id}"
  }
}

Response

Status: 400 Bad Request

{
  "error": {
    "root_cause": [
      {
        "type": "x_content_parse_exception",
        "reason": "[1:94] [lifecycle_policy] unknown field [name]"
      }
    ],
    "type": "x_content_parse_exception",
    "reason": "[1:101] [put_lifecycle_request] failed to parse field [policy]",
    "caused_by": {
      "type": "x_content_parse_exception",
      "reason": "[1:94] [lifecycle_policy] unknown field [name]"
    }
  },
  "status": 400
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: SpecificationRelated to the API spec used to generate client code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions