X-Pack API - Updating user doesn't actually acknowledge update

(Al) #1

I'm using the python elasticsearch pack library in order to automate user and role creation. Although the security.put_user() and security.put_role() methods do update the user/role if they already exists, the response returned is:

{'user': {'created': False}}


{'role': {'created': False}}

This doesn't really confirm the object was actually updated. I'm not sure if there could be a situation where the creation actually failed and returned this exact response, although It would be great if the response could acknowledge the update of an object. For example, return a response something like:

{'user': {'created': False, 'updated': True}}

would clearly indicate that the properties were successfully updated. If this seems like a reasonable modification to the X-Pack code base, I would be glad to open up a Github issue for this.

(Tim Vernum) #2

We use HTTP status codes to indicate whether the request was successful or not, there is no need to indicate anything in the body of the response.

If the HTTP response was 200 OK then the PUT was successful, otherwise it failed.
If created is true then the user/role was created as part of the request, otherwise an existing user/role was updated.
We do not indicate whether the PUT actually changed the user/role (because we don't do diff'ing on the underlying objects).

(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.