# Bulk with \_op\_type:create throws exception id must be provided

**URL:** <https://discuss.elastic.co/t/bulk-with-op-type-create-throws-exception-id-must-be-provided/120444>\
**Category:** Elasticsearch\
**Created:** [February 19, 2018, 12:07pm UTC](https://discuss.elastic.co/t/bulk-with-op-type-create-throws-exception-id-must-be-provided/120444 "2018-02-19T12:07:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fahad\_Sheikh](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@Fahad\_Sheikh](https://discuss.elastic.co/u/Fahad_Sheikh)\
**Post date:** [February 19, 2018, 12:07pm UTC](https://discuss.elastic.co/t/bulk-with-op-type-create-throws-exception-id-must-be-provided/120444/1 "2018-02-19T12:07:32Z")

</div>

elasticsearch.exceptions.RequestError: TransportError(400, u'action\_request\_validation\_exception', u'Validation Failed: 1: an id must be provided if version type or value are set;')

Using elasticsearch.helpers for python script

I expect that the api should autogenerate \_id, instead the \_id is required to be filled manually.

doc={  
'\_id':''  
'\_op\_type': 'create',  
'\_index': collection.lower() + "index",  
'\_type': collection.lower(),  
'\_source': nextrecord  
}  
yield(doc)  
bulk(es, generate\_doc())

Hope somebody can help with this...

---

<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:** [March 19, 2018, 12:08pm UTC](https://discuss.elastic.co/t/bulk-with-op-type-create-throws-exception-id-must-be-provided/120444/2 "2018-03-19T12:08:13Z")

</div>

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