Do index request's response do return after data flush to disk?

Recently find a issue that when I send a index request it takes 200ms ~ 500ms to get the response. So I want to know that do ES response to client after data flush to disk completely?

You can configure it to wait for a refresh which can take a while. A slow response may also indicate that the cluster is heavily loaded and that requests are being queued up. What does system load look like? How do you index the data? What type of storage/disk are you using?

It's not a SSD but a traditional disk. I'm try it on test environment, it's a single node and the master node and the data node are in the same vm.
Actually, I want to confirm one thing: while index the data with default configuration, when the client will recive the response? After the data flush to the disk done? Or just send flush then response to client without checking write to disk completely?


Short answer: Yes, by default, ES will wait for the transaction/request to be fsynced to disk on the primary shard AND every replica shards(if any) before replying with success to the client.

Medium answer: What is fsynced at this point in the pipeline and meant by transaction/request above is in fact a transaction log. So the real data in the shard is NOT yet fsynced to disk, only a transaction into a translog in primary+replicas.

Complete story: Better read the complete appropriate section of the doc to get it unaltered at this point, no point in relying on my understanding of it :wink:

To be clear what Christian says also applies of course, there is a queue in front of all that where your requests might spend time before being processed. I was not saying that the delay of an index request is only time to fsync.

Thanks @martinr_ubi @Christian_Dahlqvist

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.