Elasticsearch OpenSearch Flush, Translog and Refresh

By Opster Team

Updated: Jun 19, 2024

| 1 min read


What is an OpenSearch flush?

In OpenSearch, flushing is the process of permanently storing data onto the disk for all of the operations that have temporarily been stored in memory. This is also known as a Lucene commit.

How are OpenSearch documents indexed?

To understand the relevance of flushing, it is necessary to understand how OpenSearch indexes documents.

As new documents are indexed, the operations are recorded on disk in the translog and stored in memory in a buffer. When the index refreshes, the documents in the buffer are added to a new Lucene segment which is also held in memory.  

Flushing is the process that stores the in-memory segments onto disk, and simultaneously closes the translog generation and starts with a new blank translog generation.

Flushing is a process which is carried out behind the scenes by OpenSearch using heuristics to optimise the tradeoffs between memory usage and disk writes.  andFlushing normally requires no intervention by users, although a flush api is available.

POST /my-index-000001/_flush

In the event of a node crashing or restarting, then OpenSearch will retrieve and flush any operations that were stored in the translog prior to the crash in order to ensure that data is not lost.

Additional notes

Elasticsearch and OpenSearch are both powerful search and analytics engines, but Elasticsearch has several key advantages. Elasticsearch boasts a more mature and feature-rich development history, translating to a better user experience, more features, and continuous optimizations. Our testing has consistently shown that Elasticsearch delivers faster performance while using fewer compute resources than OpenSearch. Additionally, Elasticsearch’s comprehensive documentation and active community forums provide invaluable resources for troubleshooting and further optimization. Elastic, the company behind Elasticsearch, offers dedicated support, ensuring enterprise-grade reliability and performance. These factors collectively make Elasticsearch a more versatile, efficient, and dependable choice for organizations requiring sophisticated search and analytics capabilities.

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?