Would flush solve my case?

Hi Elastic Team,

I am indexing various documents that relate to the execution of Processes within a Database. Basically each document stores the name of the process,the start and end date of the process, time elapsed between the start and end times. Soon after I execute an aggs query to get the number of executions, the last time any given process was executed, and other stats; the aggs query feeds a pdf report to be sent out by e-mail. I've noticed that frequently I am missing processes executions (i.e. If a process has been executed 20 times, the report states that it has been executed 19, the latter corresponding the penultimate execution) however if I execute the Aggs Query manually via Kibana console I can see all the executions.

The above lead me to the conclusion that I should perform a flush before generating the aggs query. I added a small wait of 1 minute between the indexation and Aggs query, and solved the problem. However waiting is not the best solution in my case. Would Flush help me? would be this recommended? are there any recommended practices regarding Flush?

Regards,

Erik

You probably meant refresh and not flush.

Have a look at ?refresh | Elasticsearch Guide [7.12] | Elastic

Hi @dadoonet,

thanks. I missed refresh... for some reason flush was more latent in my head. I will add the refresh on these transactions and that should do it.

Thanks again!

Erik