You have to use "setRefresh(true)" in the index action to be able to search documents in the index immediately. Note, ES does not "commit" anything. It re-opens an index reader which is in expensive operation, do the default setting is one second for auto refresh.
"Flush" does not make sense in that context at all, it just clears the translog and all pending index requests to make sure they are passed to Lucene. Jörg On Fri, Feb 20, 2015 at 9:09 AM, Abid Hussain <[email protected]> wrote: > Hi all, > > In one of our integration test we do the following: > > 1. create an index > 2. put some docs in the created index > 3. assert that documents exist in index > > Step 3 sometimes fails if we don't put a Thread.sleep(1000) between 2 and > 3. > > After reading the docs, I think performing a FlushRequest might help: > client.admin().indices().flush(new FlushRequest(indexName)).actionGet(); > > My question is: are all changes commited when receiving the response of > the flush request or is flush request performed in an asynchrounus manner? > > Regards, > > Abid > > -- > You received this message because you are subscribed to the Google Groups > "elasticsearch" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/4dcb667c-2ab5-4457-85ff-70327e520c43%40googlegroups.com > <https://groups.google.com/d/msgid/elasticsearch/4dcb667c-2ab5-4457-85ff-70327e520c43%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoFUd6BUam1VpvGMetJUM1-ui9jR%3D%3D1b6c11rLgmfX_ayQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
