clearcache.asciidoc 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. [[indices-clearcache]]
  2. == Clear Cache
  3. The clear cache API allows to clear either all caches or specific cached
  4. associated with one or more indices.
  5. [source,js]
  6. --------------------------------------------------
  7. POST /twitter/_cache/clear
  8. --------------------------------------------------
  9. // CONSOLE
  10. // TEST[setup:twitter]
  11. The API, by default, will clear all caches. Specific caches can be cleaned
  12. explicitly by setting the `query`, `fielddata` or `request` url parameter to `true`.
  13. [source,js]
  14. --------------------------------------------------
  15. POST /twitter/_cache/clear?query=true <1>
  16. POST /twitter/_cache/clear?request=true <2>
  17. POST /twitter/_cache/clear?fielddata=true <3>
  18. --------------------------------------------------
  19. // CONSOLE
  20. // TEST[continued]
  21. <1> Cleans only the query cache
  22. <2> Cleans only the request cache
  23. <3> Cleans only the fielddata cache
  24. In addition to this, all caches relating to a specific field can also be
  25. cleared by specifying `fields` url parameter with a comma delimited list of
  26. the fields that should be cleared. Note that the provided names must refer to
  27. concrete fields -- objects and field aliases are not supported.
  28. [source,js]
  29. --------------------------------------------------
  30. POST /twitter/_cache/clear?fields=foo,bar <1>
  31. --------------------------------------------------
  32. // CONSOLE
  33. // TEST[continued]
  34. <1> Clear the cache for the `foo` an `bar` field
  35. [float]
  36. === Multi Index
  37. The clear cache API can be applied to more than one index with a single
  38. call, or even on `_all` the indices.
  39. [source,js]
  40. --------------------------------------------------
  41. POST /kimchy,elasticsearch/_cache/clear
  42. POST /_cache/clear
  43. --------------------------------------------------
  44. // CONSOLE
  45. // TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]