# Multiple content types in one field?

**URL:** <https://discuss.elastic.co/t/multiple-content-types-in-one-field/182236>\
**Category:** Elasticsearch\
**Created:** [May 22, 2019, 1:24pm UTC](https://discuss.elastic.co/t/multiple-content-types-in-one-field/182236 "2019-05-22T13:24:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dennis\_Brouwer1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dennis_brouwer1/32/45628_2.png) [@Dennis\_Brouwer1](https://discuss.elastic.co/u/Dennis_Brouwer1)\
**Post date:** [May 22, 2019, 1:24pm UTC](https://discuss.elastic.co/t/multiple-content-types-in-one-field/182236/1 "2019-05-22T13:24:32Z")

</div>

Hello,

We are in the middle of doing a POC with ES for our logging. We are talking to ES directly from our application and when a webrequest comes in it stores it in ES. It logs a "body" field to save posted body data in ES. But if you perform a get, that field contains a boolean "false", because there is no body. If we then have a post request which has actual body data ES gives an error because it expects a boolean in that field. Is there any way around this?

Regards,  
Dennis

---

<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:** [May 22, 2019, 1:48pm UTC](https://discuss.elastic.co/t/multiple-content-types-in-one-field/182236/2 "2019-05-22T13:48:06Z")

</div>

> [@Dennis\_Brouwer1](#):
>
> But if you perform a get, that field contains a boolean "false", because there is no body.

That's because you sent it that way I believe.  
What happened (that's a guess as I don't have much details here, like a way to reproduce the problem) is that the first document cames with a boolean value and that you did not define any mapping or template.  
Elasticsearch then decided that the mapping for this field is a boolean.  
The next document which is coming with a value (a text) can not be indexed as a boolean and it fails.

I'd recommend fixing the mapping before sending the very first document. So you won't use dynamic mapping anymore.

---

<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:** [June 19, 2019, 1:48pm UTC](https://discuss.elastic.co/t/multiple-content-types-in-one-field/182236/3 "2019-06-19T13:48:11Z")

</div>

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