# When i search for document after index a document. It returns empty but it returns document with sleep of 2 seconds between creating and fetching

**URL:** <https://discuss.elastic.co/t/when-i-search-for-document-after-index-a-document-it-returns-empty-but-it-returns-document-with-sleep-of-2-seconds-between-creating-and-fetching/141480>\
**Category:** Elasticsearch\
**Created:** [July 25, 2018, 4:38am UTC](https://discuss.elastic.co/t/when-i-search-for-document-after-index-a-document-it-returns-empty-but-it-returns-document-with-sleep-of-2-seconds-between-creating-and-fetching/141480 "2018-07-25T04:38:31Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Sangeeth\_Kumar](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@Sangeeth\_Kumar](https://discuss.elastic.co/u/Sangeeth_Kumar)\
**Post date:** [July 25, 2018, 5:34am UTC](https://discuss.elastic.co/t/when-i-search-for-document-after-index-a-document-it-returns-empty-but-it-returns-document-with-sleep-of-2-seconds-between-creating-and-fetching/141480/3 "2018-07-25T05:34:30Z")

</div>

Thank you for the answer. Is there anyway to ensure the indexing a document is successful before start searching it?

---

_[View the full topic](https://discuss.elastic.co/t/when-i-search-for-document-after-index-a-document-it-returns-empty-but-it-returns-document-with-sleep-of-2-seconds-between-creating-and-fetching/141480)._
