For performance reasons, Elasticsearch stores some data in memory and on a transaction log. If we want to free memory, we need to empty the transaction log, and to be sure that our data is safely written on disk, we need to flush an index.
Elasticsearch automatically provides periodic flushing on disk, but forcing flushing can be useful, for example:
- When we need to shut down a node to prevent stale data
- To have all the data in a safe state (for example, after a big indexing operation to have all the data flushed and refreshed)