123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- [[indices-clearcache]]
- === Clear cache API
- ++++
- <titleabbrev>Clear cache</titleabbrev>
- ++++
- Clears caches for one or more indices.
- [source,console]
- ----
- POST /twitter/_cache/clear
- ----
- // TEST[setup:twitter]
- [[clear-cache-api-request]]
- ==== {api-request-title}
- `POST /<index>/_cache/clear`
- `POST /_cache/clear`
- [[clear-cache-api-path-params]]
- ==== {api-path-parms-title}
- include::{docdir}/rest-api/common-parms.asciidoc[tag=index]
- [[clear-cache-api-query-params]]
- ==== {api-query-parms-title}
- include::{docdir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
- include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
- +
- Defaults to `open`.
- `fielddata`::
- +
- --
- (Optional, boolean)
- If `true`,
- clears the fields cache.
- Use the `fields` parameter
- to clear the cache of specific fields only.
- --
- `fields`::
- +
- --
- (Optional, string)
- Comma-separated list of field names
- used to limit the `fielddata` parameter.
- Defaults to all fields.
- NOTE: This parameter does *not* support objects
- or field aliases.
- --
- `index`::
- (Optional, string)
- Comma-separated list of index names
- used to limit the request.
- include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
- `query`::
- (Optional, boolean)
- If `true`,
- clears the query cache.
- `request`::
- (Optional, boolean)
- If `true`,
- clears the request cache.
- [[clear-cache-api-example]]
- ==== {api-examples-title}
- [[clear-cache-api-specific-ex]]
- ===== Clear a specific cache
- By default,
- the clear cache API clears all caches.
- You can clear only specific caches
- by setting the following query parameters to `true`:
- * `fielddata`
- * `query`
- * `request`
- [source,console]
- ----
- POST /twitter/_cache/clear?fielddata=true <1>
- POST /twitter/_cache/clear?query=true <2>
- POST /twitter/_cache/clear?request=true <3>
- ----
- // TEST[continued]
- <1> Clears only the fields cache
- <2> Clears only the query cache
- <3> Clears only the request cache
- [[clear-cache-api-specific-fields-ex]]
- ===== Clear the cache of specific fields
- To only clear the cache of specific fields,
- use the `fields` query parameter.
- [source,console]
- ----
- POST /twitter/_cache/clear?fields=foo,bar <1>
- ----
- // TEST[continued]
- <1> Clear the cache for the `foo` and `bar` field
- [[clear-cache-api-multi-ex]]
- ===== Clear caches for several indices
- [source,console]
- ----
- POST /kimchy,elasticsearch/_cache/clear
- ----
- // TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]
- [[clear-cache-api-all-ex]]
- ===== Clear caches for all indices
- [source,console]
- ----
- POST /_cache/clear
- ----
|