NearRealTime aggregation on recent inserted document

Hello,

Elasticsearch is Near Real Time. Which in short it indicates that after issuing an insert request, it will not directly appear to all search and aggregation queries.

In my application I first insert a document then at later stage in execution logic i run an aggregation, I dont see the inserted document result within the aggregated result.

Any suggested solutions ?

In order to force new inserts,updates and deletes to appear in search results you cancall the refresh API before your aggregation. Be aware that this can cause a lot of performance problems if done frequently though as making data available for search is an expensive operation (which is why Elasticsearch is near-real time).

Thanks for answering.

I missed that in my original question, I have tried it and i know its drawbacks.

I am still looking for alternative solutions if they exist.

For the documents to be searchable a refresh have to occur, so there are no alternatives. You could force a refresh at indexing time, which would remove the need for a separate API call, but that would likely have an even bigger negative impact on performance.

I see, thanks alot

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