clearcache.asciidoc 2.5 KB

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