# Getting the type/mapping of a document in the response

**URL:** <https://discuss.elastic.co/t/getting-the-type-mapping-of-a-document-in-the-response/5964>\
**Category:** Elasticsearch\
**Created:** [November 24, 2011, 2:55pm UTC](https://discuss.elastic.co/t/getting-the-type-mapping-of-a-document-in-the-response/5964 "2011-11-24T14:55:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Virgile\_Devaux\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/virgile_devaux_2/32/2139_2.png) [@Virgile\_Devaux\_2](https://discuss.elastic.co/u/Virgile_Devaux_2)\
**Post date:** [November 24, 2011, 2:55pm UTC](https://discuss.elastic.co/t/getting-the-type-mapping-of-a-document-in-the-response/5964/1 "2011-11-24T14:55:46Z")

</div>

Hello,  
i'd like to get, for each document in the response to a search, the  
type/mapping identifier corresponding to this particular document.  
For exemple, for the following search:  
$ curl -XGET '[http://localhost:9200/twitter/tweet,user/\_search](http://localhost:9200/twitter/tweet,user/_search)?  
q=user:kimchy'  
I'd like to have in each document of the response a field with a value  
of either "user" of "tweet".

Is is possible?

---

<div class="post-metadata">

**Author:** ![Jeremie\_BORDIER1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jeremie_bordier1/32/2860_2.png) [@Jeremie\_BORDIER1](https://discuss.elastic.co/u/Jeremie_BORDIER1)\
**Post date:** [November 24, 2011, 3:03pm UTC](https://discuss.elastic.co/t/getting-the-type-mapping-of-a-document-in-the-response/5964/2 "2011-11-24T15:03:02Z")

</div>

Just add \_type in the list of fields you want to retrieve.

Jérémie

On Thu, Nov 24, 2011 at 3:55 PM, Virgile Devaux [vdevaux@gmail.com](mailto:vdevaux@gmail.com) wrote:

> Hello,  
> i'd like to get, for each document in the response to a search, the  
> type/mapping identifier corresponding to this particular document.  
> For exemple, for the following search:  
> $ curl -XGET '[http://localhost:9200/twitter/tweet,user/\_search](http://localhost:9200/twitter/tweet,user/_search)?  
> q=user:kimchy'  
> I'd like to have in each document of the response a field with a value  
> of either "user" of "tweet".
> 
> Is is possible?

--  
Jérémie 'ahFeel' BORDIER

---

<div class="post-metadata">

**Author:** ![Virgile\_Devaux\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/virgile_devaux_2/32/2139_2.png) [@Virgile\_Devaux\_2](https://discuss.elastic.co/u/Virgile_Devaux_2)\
**Post date:** [November 24, 2011, 3:03pm UTC](https://discuss.elastic.co/t/getting-the-type-mapping-of-a-document-in-the-response/5964/3 "2011-11-24T15:03:25Z")

</div>

Forget about it, I was using the output of a processor that removes  
those information from the original document returned by  
Elasticsearch, that, of course, returns it.  
Sorry for the time lost.

On 24 nov, 15:55, Virgile Devaux [vdev...@gmail.com](mailto:vdev...@gmail.com) wrote:

> Hello,  
> i'd like to get, for each document in the response to a search, the  
> type/mapping identifier corresponding to this particular document.  
> For exemple, for the following search:  
> $ curl -XGET '[http://localhost:9200/twitter/tweet,user/\_search](http://localhost:9200/twitter/tweet,user/_search)?  
> q=user:kimchy'  
> I'd like to have in each document of the response a field with a value  
> of either "user" of "tweet".
> 
> Is is possible?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 24, 2011, 3:03pm UTC](https://discuss.elastic.co/t/getting-the-type-mapping-of-a-document-in-the-response/5964/4 "2011-11-24T15:03:49Z")

</div>

Don't you have it in the \_type field ?

David  
@dadoonet

Le 24 nov. 2011 à 15:55, Virgile Devaux [vdevaux@gmail.com](mailto:vdevaux@gmail.com) a écrit :

> Hello,  
> i'd like to get, for each document in the response to a search, the  
> type/mapping identifier corresponding to this particular document.  
> For exemple, for the following search:  
> $ curl -XGET '[http://localhost:9200/twitter/tweet,user/\_search](http://localhost:9200/twitter/tweet,user/_search)?  
> q=user:kimchy'  
> I'd like to have in each document of the response a field with a value  
> of either "user" of "tweet".
> 
> Is is possible?

---

<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, 3:47am UTC](https://discuss.elastic.co/t/getting-the-type-mapping-of-a-document-in-the-response/5964/5 "2017-07-06T03:47:35Z")

</div>

Closed on July 6, 2017, 3:47am UTC


