Error document missing in create document

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 ?

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