clearcache.asciidoc 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. [[indices-clearcache]]
  2. === Clear cache API
  3. ++++
  4. <titleabbrev>Clear cache</titleabbrev>
  5. ++++
  6. The clear cache API allows to clear either all caches or specific cached
  7. associated with one or more indices.
  8. [source,console]
  9. --------------------------------------------------
  10. POST /twitter/_cache/clear
  11. --------------------------------------------------
  12. // TEST[setup:twitter]
  13. The API, by default, will clear all caches. Specific caches can be cleaned
  14. explicitly by setting the `query`, `fielddata` or `request` url parameter to `true`.
  15. [source,console]
  16. --------------------------------------------------
  17. POST /twitter/_cache/clear?query=true <1>
  18. POST /twitter/_cache/clear?request=true <2>
  19. POST /twitter/_cache/clear?fielddata=true <3>
  20. --------------------------------------------------
  21. // TEST[continued]
  22. <1> Cleans only the query cache
  23. <2> Cleans only the request cache
  24. <3> Cleans only the fielddata cache
  25. In addition to this, all caches relating to a specific field can also be
  26. cleared by specifying `fields` url parameter with a comma delimited list of
  27. the fields that should be cleared. Note that the provided names must refer to
  28. concrete fields -- objects and field aliases are not supported.
  29. [source,console]
  30. --------------------------------------------------
  31. POST /twitter/_cache/clear?fields=foo,bar <1>
  32. --------------------------------------------------
  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,console]
  40. --------------------------------------------------
  41. POST /kimchy,elasticsearch/_cache/clear
  42. POST /_cache/clear
  43. --------------------------------------------------
  44. // TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]