I'm wondering if a Lucene segment is required while writing a doc to disk. Here is the brief procedure how a doc goes into disk from ElasticSearch Firstly, an ElasticSearch document is written into in-memory cache (refer to LSM-tree memTable) Secondly, a bunch of documents are refreshed to page cache (every 1s) as an immutable Lucene segment (refer to LSM-tree immutable memTable) Eventually, that segment will be "fsync" onto a disk.
It seems that we can totally bypass the "page cache" part, that's to say that at the first step, when we want to create a doc in the in-memory buffer, elasticsearch creates a segment for it. Then if we want to update that doc, elasticSearch creates another segment for the updated doc. Now we have 2 segments in total. After 1 second these two segments will be merged and refreshed on the disk.
Do you know what advantage of Lucene segment is here?