2017-06-28 14:02:40 -04:00
|
|
|
[role="xpack"]
|
2017-04-06 21:04:39 -04:00
|
|
|
[[security-api-clear-cache]]
|
2018-12-20 13:23:28 -05:00
|
|
|
=== Clear cache API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Clear cache</titleabbrev>
|
|
|
|
++++
|
2017-04-06 21:04:39 -04:00
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
Evicts users from the user cache. You can completely clear
|
2017-04-06 21:04:39 -04:00
|
|
|
the cache or evict specific users.
|
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-clear-request]]
|
|
|
|
==== {api-request-title}
|
2017-09-22 13:04:38 -04:00
|
|
|
|
2018-12-11 04:13:10 -05:00
|
|
|
`POST /_security/realm/<realms>/_clear_cache` +
|
2017-09-22 13:04:38 -04:00
|
|
|
|
2018-12-11 04:13:10 -05:00
|
|
|
`POST /_security/realm/<realms>/_clear_cache?usernames=<usernames>`
|
2017-09-22 13:04:38 -04:00
|
|
|
|
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-clear-desc]]
|
|
|
|
==== {api-description-title}
|
2017-09-22 13:04:38 -04:00
|
|
|
|
|
|
|
User credentials are cached in memory on each node to avoid connecting to a
|
|
|
|
remote authentication service or hitting the disk for every incoming request.
|
|
|
|
There are realm settings that you can use to configure the user cache. For more
|
2019-08-02 13:56:05 -04:00
|
|
|
information, see
|
|
|
|
{stack-ov}/controlling-user-cache.html[Controlling the user cache].
|
2017-09-22 13:04:38 -04:00
|
|
|
|
2018-04-17 21:03:46 -04:00
|
|
|
To evict roles from the role cache, see the
|
2019-08-02 13:56:05 -04:00
|
|
|
<<security-api-clear-role-cache,Clear roles cache API>>.
|
2018-04-17 21:03:46 -04:00
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-clear-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
2017-09-22 13:04:38 -04:00
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
`realms`::
|
|
|
|
(Required, list) A comma-separated list of the realms to clear.
|
2017-09-22 13:04:38 -04:00
|
|
|
|
|
|
|
`usernames`::
|
2019-08-02 13:56:05 -04:00
|
|
|
(Optional, list) A comma-separated list of the users to clear from the cache.
|
|
|
|
If you do not specify this parameter, the API evicts all users from the user
|
|
|
|
cache.
|
2017-09-22 13:04:38 -04:00
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-clear-example]]
|
|
|
|
==== {api-examples-title}
|
2017-09-22 13:04:38 -04:00
|
|
|
|
2017-04-06 21:04:39 -04:00
|
|
|
For example, to evict all users cached by the `file` realm:
|
|
|
|
|
2019-09-05 14:12:39 -04:00
|
|
|
[source,console]
|
2017-04-06 21:04:39 -04:00
|
|
|
--------------------------------------------------
|
2018-12-11 04:13:10 -05:00
|
|
|
POST /_security/realm/default_file/_clear_cache
|
2017-04-06 21:04:39 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
To evict selected users, specify the `usernames` parameter:
|
|
|
|
|
2019-09-05 14:12:39 -04:00
|
|
|
[source,console]
|
2017-04-06 21:04:39 -04:00
|
|
|
--------------------------------------------------
|
2018-12-11 04:13:10 -05:00
|
|
|
POST /_security/realm/default_file/_clear_cache?usernames=rdeniro,alpacino
|
2017-04-06 21:04:39 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
To clear the caches for multiple realms, specify the realms as a comma-delimited
|
|
|
|
list:
|
|
|
|
|
2019-09-05 14:12:39 -04:00
|
|
|
[source,console]
|
2017-04-06 21:04:39 -04:00
|
|
|
------------------------------------------------------------
|
2018-12-11 04:13:10 -05:00
|
|
|
POST /_security/realm/default_file,ldap1/_clear_cache
|
2017-04-06 21:04:39 -04:00
|
|
|
------------------------------------------------------------
|