# (String)attachment.get("\_content\_type") return null value

**URL:** <https://discuss.elastic.co/t/string-attachment-get--content-type-return-null-value/11048>\
**Category:** Elasticsearch\
**Created:** [March 7, 2013, 8:30am UTC](https://discuss.elastic.co/t/string-attachment-get--content-type-return-null-value/11048 "2013-03-07T08:30:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yahia](https://avatars.discourse-cdn.com/v4/letter/y/d9b06d/32.png) [@yahia](https://discuss.elastic.co/u/yahia)\
**Post date:** [March 7, 2013, 8:30am UTC](https://discuss.elastic.co/t/string-attachment-get--content-type-return-null-value/11048/1 "2013-03-07T08:30:58Z")

</div>

Hi all,

I looked through a document id, and I want to identify different document  
information returned, such as content\_type, but its value is equal to null,  
I have the following code :

```
 GetResponse responseEs = 

```

esClient.prepareGet().setIndex(INDEX\_NAME).setId(id).execute().actionGet();

```
 Map<String, Object> attachment = (Map<String, 

```

Object\>)responseEs.getSource().get("file");

```
 String contentType = (String)attachment.get("_content_type");

```

different value of the map attchement are:  
{content=dfgrr....,\_name=test.pdf}

I have not written the total value of the field content, I have not found  
the \_content\_type field ........and i don't know why this field does not  
exist....

--  
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:** ![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:** [March 7, 2013, 8:49am UTC](https://discuss.elastic.co/t/string-attachment-get--content-type-return-null-value/11048/2 "2013-03-07T08:49:29Z")

</div>

I think you are hitting this issue: [save all tika metadata · Issue #1 · elastic/elasticsearch-mapper-attachments · GitHub](https://github.com/elasticsearch/elasticsearch-mapper-attachments/issues/1)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 7 mars 2013 à 09:30, Ammar Yahia [yahia.ammar.info@gmail.com](mailto:yahia.ammar.info@gmail.com) a écrit :

> Hi all,
> 
> I looked through a document id, and I want to identify different document information returned, such as content\_type, but its value is equal to null, I have the following code :
> 
> ```
> GetResponse responseEs = esClient.prepareGet().setIndex(INDEX_NAME).setId(id).execute().actionGet();
> 
> Map<String, Object> attachment = (Map<String, Object>)responseEs.getSource().get("file");
> 
> String contentType = (String)attachment.get("_content_type");
> 
> ```
> 
> different value of the map attchement are:  
> {content=dfgrr....,\_name=test.pdf}
> 
> I have not written the total value of the field content, I have not found the \_content\_type field ........and i don't know why this field does not exist....
> 
> --  
> 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).

--  
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:** ![yahia](https://avatars.discourse-cdn.com/v4/letter/y/d9b06d/32.png) [@yahia](https://discuss.elastic.co/u/yahia)\
**Post date:** [March 7, 2013, 10:59am UTC](https://discuss.elastic.co/t/string-attachment-get--content-type-return-null-value/11048/3 "2013-03-07T10:59:52Z")

</div>

So this issue is not fixed yet ?

--  
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:47am UTC](https://discuss.elastic.co/t/string-attachment-get--content-type-return-null-value/11048/4 "2017-07-06T02:47:47Z")

</div>


