Flushing an index
Elasticsearch for performance reasons stores some data in memory and on a transaction log. If we want to free memory, empty the transaction log, and be sure that our data is safely written on disk, we need to flush an index.
Elasticsearch automatically provides periodic flush on disk, but forcing flush can be useful, for example:
When we need to shut down a node to prevent stale data
To have all the data on a safe state (for example, after a big indexing operation to have all the data flushed and refreshed)
Getting ready
You need an up-and-running Elasticsearch installation, as used in the Downloading and installing Elasticsearch recipe in Chapter 2, Downloading and Setup.
To execute curl
via the command line, you need to install curl
for your operative system.
To correctly execute the following commands, use the index created in the Creating an index recipe.
How to do it...
The HTTP method used for both operations is POST
. The URL format for flushing an index, is:
http://<server...