Elasticsearch Add a user to role-mapping

Hi All,
We are trying to create user-role mapping using the open-distro api’s.

PATCH _opendistro/_security/api/rolesmapping/<role>
    "op": "add", "path": "/users", "value": ["myuser"]

But we are getting the below error while trying to execute this command,

{“statusCode”:400,“error”:“Bad Request”,“message”:"[request query.method]: Method must be one of, case insensitive [‘HEAD’, ‘GET’, ‘POST’, ‘PUT’, ‘DELETE’]. Received ‘PATCH’."}

Can you please advise.

Lokesh V

This is related to the security plugin, so I’m going to move this to the correct category.

Hi @lokeshv1989

You need to enable PATCH API in elasticsearch.yml

Thank you @pablo and @searchymcsearchface
However I am able to see that we will not be able to modify elasticsearch.yml in AWS managed ElasticSearch clusters.

Can you then point me how to make this edit using any API or something in my case where I am having AWS managed ElasticSearch cluster.

Lokesh V

Hi @lokeshv1989

As per documentation, the PATCH API is enabled through the elasticsearch.yml file only. There is no API to enable PATCH in the running cluster.
Maybe you should try to ask your ES provider (AWS) to include the PATCH API in your cluster configuration.

1 Like

Thank you @pablo for your reply