# Error document missing in create document

**URL:** <https://discuss.elastic.co/t/error-document-missing-in-create-document/205811>\
**Category:** Elasticsearch\
**Created:** [October 30, 2019, 8:28am UTC](https://discuss.elastic.co/t/error-document-missing-in-create-document/205811 "2019-10-30T08:28:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mehrdad.dev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mehrdad.dev/32/56326_2.png) [@Mehrdad.dev](https://discuss.elastic.co/u/Mehrdad.dev)\
**Post date:** [October 30, 2019, 8:28am UTC](https://discuss.elastic.co/t/error-document-missing-in-create-document/205811/1 "2019-10-30T08:28:32Z")

</div>

Hi.  
I want to create a new document in elastic search with golang.  
my code :

```
   _, err := s.client.Index().Index("profile").Type(typ).Id(user.ID).BodyJson(user).Do(ctx)
    if err != nil {
    	return err
    }

```

this function listen from nats and then create the document .  
but when i want create a document show this error :

```
err="elastic: Error 404 (Not Found): [profile][p-mehrdad]: document missing 
[type=document_missing_exception]"

```

but when i want update a document with this code it is ok :

```
_, err := s.client.Update().Index("profile").Type(typ).Id(user.ID).Doc(user).Do(ctx)
if err != nil {
	return err
} 

```

**can you help me ?**

---

<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 27, 2019, 8:37am UTC](https://discuss.elastic.co/t/error-document-missing-in-create-document/205811/2 "2019-11-27T08:37:31Z")

</div>

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