OpenSearch/x-pack/docs/en/rest-api/security/clear-api-key-cache.asciidoc
Yang Wang 7969fbb4ab
Cache API key doc to reduce traffic to the security index (#59376) (#63319)
Getting the API key document form the security index is the most time consuing part
of the API Key authentication flow (>60% if index is local and >90% if index is remote).
This traffic is now avoided by caching added with this PR.

Additionally, we add a cache invalidator registry so that clearing of different caches will
be managed in a single place (requires follow-up PRs).
2020-10-06 23:49:23 +11:00

44 lines
1.3 KiB
Plaintext

[role="xpack"]
[[security-api-clear-api-key-cache]]
=== Clear API key cache API
++++
<titleabbrev>Clear API key cache</titleabbrev>
++++
Evicts a subset of all entries from the API key cache.
The cache is also automatically cleared on state changes of the security index.
[[security-api-clear-api-key-cache-request]]
==== {api-request-title}
`POST /_security/api_key/<ids>/_clear_cache`
[[security-api-clear-api-key-cache-prereqs]]
==== {api-prereq-title}
* To use this API, you must have at least the `manage_security` cluster
privilege.
[[security-api-clear-api-key-cache-desc]]
==== {api-description-title}
For more information about API keys, see <<security-api-create-api-key>>,
<<security-api-get-api-key>>, and <<security-api-invalidate-api-key>>.
[[security-api-clear-api-key-cache-path-params]]
==== {api-path-parms-title}
`ids`::
(string) comma separated list of API key IDs. If empty, all keys are evicted from the cache.
[[security-api-clear-api-key-cache-example]]
==== {api-examples-title}
The clear API key cache API evicts entries from the API key cache.
For example, to clear the entry of API key with ID `yVGMr3QByxdh1MSaicYx`.
[source,console]
--------------------------------------------------
POST /_security/api_key/yVGMr3QByxdh1MSaicYx/_clear_cache
--------------------------------------------------