flush.asciidoc 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. --
  2. :api: flush
  3. :request: FlushRequest
  4. :response: FlushResponse
  5. --
  6. [id="{upid}-{api}"]
  7. === Flush API
  8. [id="{upid}-{api}-request"]
  9. ==== Flush Request
  10. A +{request}+ can be applied to one or more indices, or even on `_all` the indices:
  11. ["source","java",subs="attributes,callouts,macros"]
  12. --------------------------------------------------
  13. include-tagged::{doc-tests-file}[{api}-request]
  14. --------------------------------------------------
  15. <1> Flush one index
  16. <2> Flush multiple indices
  17. <3> Flush all the indices
  18. ==== Optional arguments
  19. ["source","java",subs="attributes,callouts,macros"]
  20. --------------------------------------------------
  21. include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
  22. --------------------------------------------------
  23. <1> Setting `IndicesOptions` controls how unavailable indices are resolved and
  24. how wildcard expressions are expanded
  25. ["source","java",subs="attributes,callouts,macros"]
  26. --------------------------------------------------
  27. include-tagged::{doc-tests-file}[{api}-request-wait]
  28. --------------------------------------------------
  29. <1> Set the `wait_if_ongoing` flag to `true`
  30. ["source","java",subs="attributes,callouts,macros"]
  31. --------------------------------------------------
  32. include-tagged::{doc-tests-file}[{api}-request-force]
  33. --------------------------------------------------
  34. <1> Set the `force` flag to `true`
  35. include::../execution.asciidoc[]
  36. [id="{upid}-{api}-response"]
  37. ==== Flush Response
  38. The returned +{response}+ allows to retrieve information about the
  39. executed operation as follows:
  40. ["source","java",subs="attributes,callouts,macros"]
  41. --------------------------------------------------
  42. include-tagged::{doc-tests-file}[{api}-response]
  43. --------------------------------------------------
  44. <1> Total number of shards hit by the flush request
  45. <2> Number of shards where the flush has succeeded
  46. <3> Number of shards where the flush has failed
  47. <4> A list of failures if the operation failed on one or more shards
  48. By default, if the indices were not found, an `ElasticsearchException` will be thrown:
  49. ["source","java",subs="attributes,callouts,macros"]
  50. --------------------------------------------------
  51. include-tagged::{doc-tests-file}[{api}-notfound]
  52. --------------------------------------------------
  53. <1> Do something if the indices to be flushed were not found