# Elasticsearch 5.x: Is it possible to ignore missing inner object when indexing?

**URL:** <https://discuss.elastic.co/t/elasticsearch-5-x-is-it-possible-to-ignore-missing-inner-object-when-indexing/123328>\
**Category:** Elasticsearch\
**Created:** [March 9, 2018, 7:11pm UTC](https://discuss.elastic.co/t/elasticsearch-5-x-is-it-possible-to-ignore-missing-inner-object-when-indexing/123328 "2018-03-09T19:11:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shangsunset](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@shangsunset](https://discuss.elastic.co/u/shangsunset)\
**Post date:** [March 9, 2018, 7:11pm UTC](https://discuss.elastic.co/t/elasticsearch-5-x-is-it-possible-to-ignore-missing-inner-object-when-indexing/123328/1 "2018-03-09T19:11:07Z")

</div>

So in my mapping shown below, `lonlat` is `geo-shape` inside `location`.

```
"location": {
  "type": "object",
  "properties" : {
    "lonlat" : {
      "type" : "geo_shape"
     },
     ...
  }
},

```

My problem is that when indexing documents, some data don't have `location` and Elasticsearch would return error `{"type":"mapper_parsing_exception","reason":"failed to parse [location.lonlat]","caused_by":{"reason":"shape type not included","type":"parse_exception"}}` and reject the whole document.

Is there a way to make Elasticsearch ignore the missing properties in `location` and index the document anyway? I saw there is a new parameter under `geo-shape` type called `ignore-malformed` in Elasticsearch 6.x, will that help my situation?

Thanks!

---

<div class="post-metadata">

**Author:** ![whicter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/whicter/32/28514_2.png) [@whicter](https://discuss.elastic.co/u/whicter)\
**Post date:** [March 9, 2018, 7:18pm UTC](https://discuss.elastic.co/t/elasticsearch-5-x-is-it-possible-to-ignore-missing-inner-object-when-indexing/123328/2 "2018-03-09T19:18:38Z")

</div>

What I did for a similar situation is to check if certain error is in [tags] and do the following:

```
if "ERROR_TYPE" in [tags] {
        mutate {
            add_field => { "parsing_error" => "ERROR_TYPE" }
        }
    }
}

```

and create a custom search criteria in kibana to exclude those records. Hope that helps

---

<div class="post-metadata">

**Author:** ![shangsunset](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@shangsunset](https://discuss.elastic.co/u/shangsunset)\
**Post date:** [March 9, 2018, 7:38pm UTC](https://discuss.elastic.co/t/elasticsearch-5-x-is-it-possible-to-ignore-missing-inner-object-when-indexing/123328/3 "2018-03-09T19:38:07Z")

</div>

Hi @whicter ,

Thanks for your response. What are [tags]? Are you suggesting I should check for the error type when indexing data and handle the error accordingly? If the error is thrown, doesn't it mean that the Elasticsearch already rejected the document?

Thanks.

---

<div class="post-metadata">

**Author:** ![whicter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/whicter/32/28514_2.png) [@whicter](https://discuss.elastic.co/u/whicter)\
**Post date:** [March 9, 2018, 9:35pm UTC](https://discuss.elastic.co/t/elasticsearch-5-x-is-it-possible-to-ignore-missing-inner-object-when-indexing/123328/4 "2018-03-09T21:35:56Z")

</div>

I did stdout { codec =\> rubydebug } together with elasticsearch. If there are some parse error for the single message, it will be put into [tags].

For my scenarios, the message will still be sent to elasticsearch but the grok filter just doesn't work for those messages

---

<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:** [April 6, 2018, 9:36pm UTC](https://discuss.elastic.co/t/elasticsearch-5-x-is-it-possible-to-ignore-missing-inner-object-when-indexing/123328/5 "2018-04-06T21:36:12Z")

</div>

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