2013-08-28 19:24:34 -04:00
|
|
|
[[indices-clearcache]]
|
2019-10-01 17:07:28 -04:00
|
|
|
=== Clear cache API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Clear cache</titleabbrev>
|
|
|
|
++++
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
The clear cache API allows to clear either all caches or specific cached
|
2016-03-09 09:32:54 -05:00
|
|
|
associated with one or more indices.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2016-09-01 13:05:22 -04:00
|
|
|
POST /twitter/_cache/clear
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2016-09-01 13:05:22 -04:00
|
|
|
// TEST[setup:twitter]
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2014-08-06 05:54:51 -04:00
|
|
|
The API, by default, will clear all caches. Specific caches can be cleaned
|
2018-10-18 18:44:37 -04:00
|
|
|
explicitly by setting the `query`, `fielddata` or `request` url parameter to `true`.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2018-10-18 18:44:37 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
POST /twitter/_cache/clear?query=true <1>
|
|
|
|
POST /twitter/_cache/clear?request=true <2>
|
|
|
|
POST /twitter/_cache/clear?fielddata=true <3>
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
2019-09-06 11:31:13 -04:00
|
|
|
|
2018-10-18 18:44:37 -04:00
|
|
|
<1> Cleans only the query cache
|
|
|
|
<2> Cleans only the request cache
|
|
|
|
<3> Cleans only the fielddata cache
|
|
|
|
|
|
|
|
In addition to this, all caches relating to a specific field can also be
|
|
|
|
cleared by specifying `fields` url parameter with a comma delimited list of
|
|
|
|
the fields that should be cleared. Note that the provided names must refer to
|
|
|
|
concrete fields -- objects and field aliases are not supported.
|
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2018-10-18 18:44:37 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
POST /twitter/_cache/clear?fields=foo,bar <1>
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[continued]
|
2019-09-06 11:31:13 -04:00
|
|
|
|
2018-10-18 18:44:37 -04:00
|
|
|
<1> Clear the cache for the `foo` an `bar` field
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
[float]
|
2019-07-19 14:35:36 -04:00
|
|
|
==== Multi Index
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
The clear cache API can be applied to more than one index with a single
|
|
|
|
call, or even on `_all` the indices.
|
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2016-09-01 13:05:22 -04:00
|
|
|
POST /kimchy,elasticsearch/_cache/clear
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2016-09-01 13:05:22 -04:00
|
|
|
POST /_cache/clear
|
2013-08-28 19:24:34 -04:00
|
|
|
--------------------------------------------------
|
2016-09-01 13:05:22 -04:00
|
|
|
// TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]
|