clearcache.asciidoc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. [[indices-clearcache]]
  2. === Clear cache API
  3. ++++
  4. <titleabbrev>Clear cache</titleabbrev>
  5. ++++
  6. Clears caches for one or more indices.
  7. [source,console]
  8. ----
  9. POST /twitter/_cache/clear
  10. ----
  11. // TEST[setup:twitter]
  12. [[clear-cache-api-request]]
  13. ==== {api-request-title}
  14. `POST /<index>/_cache/clear`
  15. `POST /_cache/clear`
  16. [[clear-cache-api-path-params]]
  17. ==== {api-path-parms-title}
  18. include::{docdir}/rest-api/common-parms.asciidoc[tag=index]
  19. [[clear-cache-api-query-params]]
  20. ==== {api-query-parms-title}
  21. include::{docdir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
  22. include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
  23. +
  24. Defaults to `open`.
  25. `fielddata`::
  26. +
  27. --
  28. (Optional, boolean)
  29. If `true`,
  30. clears the fields cache.
  31. Use the `fields` parameter
  32. to clear the cache of specific fields only.
  33. --
  34. `fields`::
  35. +
  36. --
  37. (Optional, string)
  38. Comma-separated list of field names
  39. used to limit the `fielddata` parameter.
  40. Defaults to all fields.
  41. NOTE: This parameter does *not* support objects
  42. or field aliases.
  43. --
  44. `index`::
  45. (Optional, string)
  46. Comma-separated list of index names
  47. used to limit the request.
  48. include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
  49. `query`::
  50. (Optional, boolean)
  51. If `true`,
  52. clears the query cache.
  53. `request`::
  54. (Optional, boolean)
  55. If `true`,
  56. clears the request cache.
  57. [[clear-cache-api-example]]
  58. ==== {api-examples-title}
  59. [[clear-cache-api-specific-ex]]
  60. ===== Clear a specific cache
  61. By default,
  62. the clear cache API clears all caches.
  63. You can clear only specific caches
  64. by setting the following query parameters to `true`:
  65. * `fielddata`
  66. * `query`
  67. * `request`
  68. [source,console]
  69. ----
  70. POST /twitter/_cache/clear?fielddata=true <1>
  71. POST /twitter/_cache/clear?query=true <2>
  72. POST /twitter/_cache/clear?request=true <3>
  73. ----
  74. // TEST[continued]
  75. <1> Clears only the fields cache
  76. <2> Clears only the query cache
  77. <3> Clears only the request cache
  78. [[clear-cache-api-specific-fields-ex]]
  79. ===== Clear the cache of specific fields
  80. To only clear the cache of specific fields,
  81. use the `fields` query parameter.
  82. [source,console]
  83. ----
  84. POST /twitter/_cache/clear?fields=foo,bar <1>
  85. ----
  86. // TEST[continued]
  87. <1> Clear the cache for the `foo` and `bar` field
  88. [[clear-cache-api-multi-ex]]
  89. ===== Clear caches for several indices
  90. [source,console]
  91. ----
  92. POST /kimchy,elasticsearch/_cache/clear
  93. ----
  94. // TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]
  95. [[clear-cache-api-all-ex]]
  96. ===== Clear caches for all indices
  97. [source,console]
  98. ----
  99. POST /_cache/clear
  100. ----