# Is \_type really optional?

**URL:** <https://discuss.elastic.co/t/is--type-really-optional/4183>\
**Category:** Elasticsearch\
**Created:** [April 2, 2011, 10:41pm UTC](https://discuss.elastic.co/t/is--type-really-optional/4183 "2011-04-02T22:41:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmurphy747](https://avatars.discourse-cdn.com/v4/letter/d/8e7dd6/32.png) [@dmurphy747](https://discuss.elastic.co/u/dmurphy747)\
**Post date:** [April 2, 2011, 10:41pm UTC](https://discuss.elastic.co/t/is--type-really-optional/4183/1 "2011-04-02T22:41:35Z")

</div>

I'm trying to use the bulk API, which says  
"In the optional source part, the `type` is optional as is when  
indexing data."  
but if I leave off the "\_type" field, I get an error. Am I reading it  
correctly?

--Dave

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 3, 2011, 5:57am UTC](https://discuss.elastic.co/t/is--type-really-optional/4183/2 "2011-04-03T05:57:14Z")

</div>

Yea, what is meant is that the type as the top level object in the source is optional. Actually, it is usually best to not include it in the source as the top level object.  
On Sunday, April 3, 2011 at 1:41 AM, dmurphy747 wrote:

> I'm trying to use the bulk API, which says  
> "In the optional source part, the `type` is optional as is when  
> indexing data."  
> but if I leave off the "\_type" field, I get an error. Am I reading it  
> correctly?
> 
> --Dave

---

<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:** [July 6, 2017, 4:08am UTC](https://discuss.elastic.co/t/is--type-really-optional/4183/3 "2017-07-06T04:08:57Z")

</div>

Closed on July 6, 2017, 4:08am UTC


