# Index multi-type field or Handle Exceptions

**URL:** <https://discuss.elastic.co/t/index-multi-type-field-or-handle-exceptions/83911>\
**Category:** Elasticsearch\
**Created:** [April 27, 2017, 5:21pm UTC](https://discuss.elastic.co/t/index-multi-type-field-or-handle-exceptions/83911 "2017-04-27T17:21:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rodrigokroll](https://avatars.discourse-cdn.com/v4/letter/r/ed655f/32.png) [@rodrigokroll](https://discuss.elastic.co/u/rodrigokroll)\
**Post date:** [April 27, 2017, 5:21pm UTC](https://discuss.elastic.co/t/index-multi-type-field-or-handle-exceptions/83911/1 "2017-04-27T17:21:36Z")

</div>

Hello ALL,

I'm working with Logstash and Elasticsearch. I have a field provided through logs called (total-bytes), which is an integer.

My ElasticSearch index configuration for this field is:

```
      "total-bytes" : { 
        "type" : "integer"
      },

```

Depending on the action, sometimes the same log type is received but without "total-bytes" information. Instead the field is populated with a dash, "-". When this happens, an index failure happens. Because the field was supposed to be an integer.

How am I suppose to handle exceptions in my index schema? I need to keep the configuration as "integer" for further purposes and in the same time I want to avoid errors and store the log when "total-bytes" is null.

I was thinking to mutate the "-" and replace by "0" but I'm not sure if there is a better solution, instead of this workaround.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![rodrigokroll](https://avatars.discourse-cdn.com/v4/letter/r/ed655f/32.png) [@rodrigokroll](https://discuss.elastic.co/u/rodrigokroll)\
**Post date:** [May 1, 2017, 2:57pm UTC](https://discuss.elastic.co/t/index-multi-type-field-or-handle-exceptions/83911/2 "2017-05-01T14:57:27Z")

</div>

I found the solution using mutate or ruby filter.

It wasn't working before, because my ruby filter it was before my grok statement.

---

<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:** [May 29, 2017, 3:02pm UTC](https://discuss.elastic.co/t/index-multi-type-field-or-handle-exceptions/83911/3 "2017-05-29T15:02:27Z")

</div>

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