# Specifying content type for attachment

**URL:** <https://discuss.elastic.co/t/specifying-content-type-for-attachment/93142>\
**Category:** Elasticsearch\
**Created:** [July 14, 2017, 8:37am UTC](https://discuss.elastic.co/t/specifying-content-type-for-attachment/93142 "2017-07-14T08:37:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jshraddha](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@jshraddha](https://discuss.elastic.co/u/jshraddha)\
**Post date:** [July 14, 2017, 8:37am UTC](https://discuss.elastic.co/t/specifying-content-type-for-attachment/93142/1 "2017-07-14T08:37:52Z")

</div>

Hi,

I am using ingest attachment plugin to ingest my html documents . Plugin automatically takes content type and it is showing "text/html" for one document and "text/plain" for other. Is there any way where we can specify content type for the ingesting data? I want both documents to have same content type.

Thanks in advance.

---

<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:** [July 27, 2017, 4:19pm UTC](https://discuss.elastic.co/t/specifying-content-type-for-attachment/93142/2 "2017-07-27T16:19:42Z")

</div>

What you can probably do is to use a `set` processor to set `attachment.content_type` to whatever value you wish.

Is that what you are looking for?

---

<div class="post-metadata">

**Author:** ![jshraddha](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@jshraddha](https://discuss.elastic.co/u/jshraddha)\
**Post date:** [July 31, 2017, 8:39am UTC](https://discuss.elastic.co/t/specifying-content-type-for-attachment/93142/3 "2017-07-31T08:39:46Z")

</div>

Yes I am looking for something like this only. Is there a java API to set content type? Could you please provide the documentation link for the set API you mentioned above?

---

<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:** [July 31, 2017, 8:52am UTC](https://discuss.elastic.co/t/specifying-content-type-for-attachment/93142/4 "2017-07-31T08:52:23Z")

</div>

You can call the set processor the same way you are calling the attachment processor.

---

<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:** [August 28, 2017, 8:52am UTC](https://discuss.elastic.co/t/specifying-content-type-for-attachment/93142/5 "2017-08-28T08:52:33Z")

</div>

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