# Exactly what are types?

**URL:** <https://discuss.elastic.co/t/exactly-what-are-types/10833>\
**Category:** Elasticsearch\
**Created:** [February 21, 2013, 3:48am UTC](https://discuss.elastic.co/t/exactly-what-are-types/10833 "2013-02-21T03:48:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![caymanag](https://avatars.discourse-cdn.com/v4/letter/c/8dc957/32.png) [@caymanag](https://discuss.elastic.co/u/caymanag)\
**Post date:** [February 21, 2013, 3:48am UTC](https://discuss.elastic.co/t/exactly-what-are-types/10833/1 "2013-02-21T03:48:27Z")

</div>

After inserting the following document:  
curl -XPOST 'localhost:9200/twitter/tweet/1' -d ' { "f1":"abc","f3":"ghi" }'

I discovered that I can search it four ways:  
curl -XGET 'localhost:9200/twitter/\_search?q=f1=abc'  
curl -XGET 'localhost:9200/twitter/tweet/\_search?q=f1=abc'  
curl -XGET 'localhost:9200/twitter/tweet/\_search?q=tweet.f1=abc'  
curl -XGET 'localhost:9200/twitter/\_search?q=tweet.f1=abc'

So, in trying to get my head around just what a type is, I see that I must  
specify the type when I insert the document. For example, the following  
doesn't work:  
curl -XPOST 'localhost:9200/twitter/' -d ' { "a": "val" } '  
However, I can include the type with the data when inserting:  
curl -XPOST 'localhost:9200/twitter/tweet/2' -d ' { "tweet": {  
"f1":"abc","f3":"ghi" } }'

So, are documents 1 and 2 indexed exactly the same? Are there any  
advantages to indexing and searching with and without the type? The only  
difference I see is that the \_source field appears to store the document  
exactly as it is entered, so that doc 1 is returned as: {  
"f1":"abc","f3":"ghi" } and doc 2 is returned as: { "tweet": {  
"f2":"def","f3":"ghi" } }

Thank you for any recommendations and insight.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:50am UTC](https://discuss.elastic.co/t/exactly-what-are-types/10833/2 "2017-07-06T02:50:24Z")

</div>


