# Document indexed asynchronously

**URL:** <https://discuss.elastic.co/t/document-indexed-asynchronously/287090>\
**Category:** Elastic Search\
**Created:** [October 19, 2021, 12:38pm UTC](https://discuss.elastic.co/t/document-indexed-asynchronously/287090 "2021-10-19T12:38:08Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ntruongsinh](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@ntruongsinh](https://discuss.elastic.co/u/ntruongsinh)\
**Post date:** [October 19, 2021, 12:38pm UTC](https://discuss.elastic.co/t/document-indexed-asynchronously/287090/1 "2021-10-19T12:38:09Z")

</div>

Hi everyone,  
As I know that when we create a document, this document will be indexed asynchronously as mentioned here [Documents API | Elastic App Search Documentation [7.15] | Elastic](https://www.elastic.co/guide/en/app-search/current/documents.html#documents-create).  
So when I create the document, it returns an id and I perform a search with id filter immediately, usually, it will return no result for this id.  
However, when I get the document by id with that endpoint [Documents API | Elastic App Search Documentation [7.15] | Elastic](https://www.elastic.co/guide/en/app-search/current/documents.html#documents-params-get), it looks like that I can always get back the document by the newly created id. So is it correct, could I make use of it to overcome the not found result above?

Thank you.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 19, 2021, 9:06pm UTC](https://discuss.elastic.co/t/document-indexed-asynchronously/287090/2 "2021-10-19T21:06:53Z")

</div>

As those docs say;

> **The documents are indexed asynchronously.**
> 
> **There will be a processing delay before they are available to your Engine.**

You will need to put in a bit of a wait for your search.

---

<div class="post-metadata">

**Author:** ![ntruongsinh](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@ntruongsinh](https://discuss.elastic.co/u/ntruongsinh)\
**Post date:** [October 20, 2021, 3:22am UTC](https://discuss.elastic.co/t/document-indexed-asynchronously/287090/3 "2021-10-20T03:22:42Z")

</div>

> [@ntruongsinh](#):
>
> Documents API | Elastic App Search Documentation [7.15] | Elastic

Hi @warkolm , you're right, we need to wait a little bit before searching, but how about this one [Documents API | App Search documentation [8.11] | Elastic](https://www.elastic.co/guide/en/app-search/current/documents.html#documents-params-get), do we need to wait?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 20, 2021, 3:29am UTC](https://discuss.elastic.co/t/document-indexed-asynchronously/287090/4 "2021-10-20T03:29:18Z")

</div>

Yes, because that page still says there's a delay.

---

<div class="post-metadata">

**Author:** ![ntruongsinh](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@ntruongsinh](https://discuss.elastic.co/u/ntruongsinh)\
**Post date:** [October 20, 2021, 7:03am UTC](https://discuss.elastic.co/t/document-indexed-asynchronously/287090/5 "2021-10-20T07:03:14Z")

</div>

Hi @warkolm , yeah I want to confirm because I did 2 test cases:

- Create and search with id filter -\> return no result
- Create and get by id -\> having the result.  
So I feel that we don't need to wait to call get by id.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 20, 2021, 9:34pm UTC](https://discuss.elastic.co/t/document-indexed-asynchronously/287090/6 "2021-10-20T21:34:53Z")

</div>

No you don't.

This is how Elasticsearch works, [Near real-time search | Elasticsearch Guide [7.15] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.15/near-real-time.html) goes into that more.

---

<div class="post-metadata">

**Author:** ![ntruongsinh](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@ntruongsinh](https://discuss.elastic.co/u/ntruongsinh)\
**Post date:** [October 21, 2021, 10:26am UTC](https://discuss.elastic.co/t/document-indexed-asynchronously/287090/7 "2021-10-21T10:26:59Z")

</div>

I see. Thank you so much, @warkolm. Let me take a look at Elasticsearch for more information.

---

<div class="post-metadata">

**Author:** ![ntruongsinh](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@ntruongsinh](https://discuss.elastic.co/u/ntruongsinh)\
**Post date:** [October 25, 2021, 4:45am UTC](https://discuss.elastic.co/t/document-indexed-asynchronously/287090/8 "2021-10-25T04:45:00Z")

</div>

Hi @warkolm ,  
After debugging and investigating, I saw that for the get by id [Documents API | Elastic App Search Documentation [7.15] | Elastic](https://www.elastic.co/guide/en/app-search/current/documents.html#documents-params-get), it will trigger a multiget in Elasticsearch.

```auto
GET http://elasticsearch:9200/.ent-search-engine-documents-abc/_mget"
{
  "ids":[
  "2aa83e11-ddf6-4336-81b8-bb9f72984acd"
  ]
}

```

And as Elasticsearch document said that: [Get API | Elasticsearch Guide [7.15] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html#realtime) ([Multi get (mget) API | Elasticsearch Guide [7.15] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html#docs-multi-get-api-query-params) the same mechanism)  
So it looks like that my assumption is correct. Could you help me double-check that?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 25, 2021, 4:53am UTC](https://discuss.elastic.co/t/document-indexed-asynchronously/287090/9 "2021-10-25T04:53:45Z")

</div>

A get will always return the document, yes.

---

<div class="post-metadata">

**Author:** ![ntruongsinh](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@ntruongsinh](https://discuss.elastic.co/u/ntruongsinh)\
**Post date:** [October 25, 2021, 4:59am UTC](https://discuss.elastic.co/t/document-indexed-asynchronously/287090/10 "2021-10-25T04:59:18Z")

</div>

Thank you for the confirmation, @warkolm.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 4, 2022, 8:32am UTC](https://discuss.elastic.co/t/document-indexed-asynchronously/287090/11 "2022-11-04T08:32:44Z")

</div>


