security_exception: security_exception: unable to authenticate / action [...] is unauthorized for user [...] (HTTP 401/403)
ElasticsearchWhat does it mean?
Authentication (401 Unauthorized) or authorization (403 Forbidden) failed. 401 indicates missing/incorrect credentials; 403 indicates the user is authenticated but lacks the required role/privilege for this action/index.
Why does it happen?
Wrong username/password or API key, a missing Authorization header, an expired/invalid token, the user lacking the relevant index or cluster privilege, or a missing/incorrect role assignment.
How to fix it
For 401: send the correct credentials/API key and check the Authorization header. For 403: inspect the user's roles and privileges (GET _security/user/app_user, GET _security/role/app_role) and add the required index/cluster privileges. Follow the principle of least privilege. If you use an API key, verify its expiration and permissions.
More from this engine
- no_shard_available_action_exceptionno_shard_available_action_exception: No shard available for [...]
- es_rejected_execution_exceptiones_rejected_execution_exception: rejected execution of ... on ... (queue capacity ...) (HTTP 429)
- master_not_discovered_exceptionmaster_not_discovered_exception / MasterNotDiscoveredException
- validation_exceptionvalidation_exception / illegal_argument_exception: Validation Failed: ...
- task_cancelled_exceptiontask_cancelled_exception: Task was cancelled / TaskCancelledException
- action_request_validation_exceptionaction_request_validation_exception
- index_closed_exceptionindex_closed_exception