IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Change Password API
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Change Password API
editExecution
editA user’s password can be changed using the security().changePassword()
method:
ChangePasswordRequest request = new ChangePasswordRequest("change_password_user", newPassword, RefreshPolicy.NONE);
EmptyResponse response = client.security().changePassword(request, RequestOptions.DEFAULT);
Response
editThe returned EmptyResponse does not contain any fields. The return of this
response indicates a successful request.
Asynchronous Execution
editThis request can be executed asynchronously:
The asynchronous method does not block and returns immediately. Once the request
has completed the ActionListener is called back using the onResponse method
if the execution successfully completed or using the onFailure method if
it failed.
A typical listener for a EmptyResponse looks like:
ChangePasswordRequest request = new ChangePasswordRequest("change_password_user", password, RefreshPolicy.NONE);
ActionListener<EmptyResponse> listener = new ActionListener<EmptyResponse>() {
@Override
public void onResponse(EmptyResponse emptyResponse) {
}
@Override
public void onFailure(Exception e) {
}
};