flush.asciidoc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. [[indices-flush]]
  2. === Flush API
  3. ++++
  4. <titleabbrev>Flush</titleabbrev>
  5. ++++
  6. Flushes one or more indices.
  7. [source,console]
  8. --------------------------------------------------
  9. POST /twitter/_flush
  10. --------------------------------------------------
  11. // TEST[setup:twitter]
  12. [[flush-api-request]]
  13. ==== {api-request-title}
  14. `POST /<index>/_flush`
  15. `GET /<index>/_flush`
  16. `POST /_flush`
  17. `GET /_flush`
  18. [[flush-api-desc]]
  19. ==== {api-description-title}
  20. Flushing an index is the process of making sure that any data that is currently
  21. only stored in the <<index-modules-translog,transaction log>> is also
  22. permanently stored in the Lucene index. When restarting, {es} replays any
  23. unflushed operations from the transaction log into the Lucene index to bring it
  24. back into the state that it was in before the restart. {es} automatically
  25. triggers flushes as needed, using heuristics that trade off the size of the
  26. unflushed transaction log against the cost of performing each flush.
  27. Once each operation has been flushed it is permanently stored in the Lucene
  28. index. This may mean that there is no need to maintain an additional copy of it
  29. in the transaction log. The transaction log is made up of multiple files,
  30. called _generations_, and {es} will delete any generation files once they are no
  31. longer needed, freeing up disk space.
  32. It is also possible to trigger a flush on one or more indices using the flush
  33. API, although it is rare for users to need to call this API directly. If you
  34. call the flush API after indexing some documents then a successful response
  35. indicates that {es} has flushed all the documents that were indexed before the
  36. flush API was called.
  37. [[flush-api-path-params]]
  38. ==== {api-path-parms-title}
  39. include::{docdir}/rest-api/common-parms.asciidoc[tag=index]
  40. +
  41. To flush all indices,
  42. omit this parameter
  43. or use a value of `_all` or `*`.
  44. [[flush-api-query-params]]
  45. ==== {api-query-parms-title}
  46. include::{docdir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
  47. +
  48. Defaults to `true`.
  49. include::{docdir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
  50. +
  51. Defaults to `open`.
  52. `force`::
  53. +
  54. --
  55. (Optional, boolean)
  56. If `true`,
  57. the request forces a flush
  58. even if there are no changes to commit to the index.
  59. Defaults to `true`.
  60. You can use this parameter
  61. to increment the generation number of the transaction log.
  62. This parameter is considered internal.
  63. --
  64. include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
  65. `wait_if_ongoing`::
  66. +
  67. --
  68. (Optional, boolean)
  69. If `true`,
  70. the flush operation blocks until execution
  71. when another flush operation is running.
  72. If `false`,
  73. {es} returns an error
  74. if you request a flush
  75. when another flush operation is running.
  76. Defaults to `true`.
  77. --
  78. [[flush-api-example]]
  79. ==== {api-examples-title}
  80. [[flush-api-specific-ex]]
  81. ===== Flush a specific index
  82. [source,console]
  83. ----
  84. POST /kimchy/_flush
  85. ----
  86. // TEST[s/^/PUT kimchy\n/]
  87. [[flush-multi-index]]
  88. ===== Flush several indices
  89. [source,console]
  90. ----
  91. POST /kimchy,elasticsearch/_flush
  92. ----
  93. // TEST[s/^/PUT kimchy\nPUT elasticsearch\n/]
  94. [[flush-api-all-ex]]
  95. ===== Flush all indices
  96. [source,console]
  97. ----
  98. POST /_flush
  99. ----