clearcache.asciidoc 1.7 KB

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