# Logstash XML Parser

**URL:** <https://discuss.elastic.co/t/logstash-xml-parser/84135>\
**Category:** Logstash\
**Created:** [May 1, 2017, 7:42am UTC](https://discuss.elastic.co/t/logstash-xml-parser/84135 "2017-05-01T07:42:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pranil\_Ambule](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pranil_ambule/32/16208_2.png) [@Pranil\_Ambule](https://discuss.elastic.co/u/Pranil_Ambule)\
**Post date:** [May 1, 2017, 7:42am UTC](https://discuss.elastic.co/t/logstash-xml-parser/84135/1 "2017-05-01T07:42:52Z")

</div>

I'm parsing a lot of xml files using xml filter.  
But for some files I'm getting errors like

```
"Can't merge a non object mapping [doc.Body.EnumerateResponse.Items.DCIM_BaseMetricValue.Duration] with an object mapping"` 

```

and

```
"error"=>{"type"=>"illegal_argument_exception", "reason"=>"mapper [doc.Body.EnumerateResponse.Items.DCIM_PSNumericSensor.SettableThresholds] of different type, current_type [text], merged_type [ObjectMapper]"}}},

```

so how can i ignore these wrongly formatted xml tags and put the rest of the parsed data in ES.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [May 3, 2017, 5:11am UTC](https://discuss.elastic.co/t/logstash-xml-parser/84135/2 "2017-05-03T05:11:10Z")

</div>

This isn't a problem with the XML parser but with the mappings in Elasticsearch. A given field in an index needs to have exactly one type but in your example the same field has initially been mapped as a text field and now you're trying to pass a document where the same field is an object.

I don't think there's a way to drop the offending field and insert the rest of the document.

---

<div class="post-metadata">

**Author:** ![Pranil\_Ambule](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pranil_ambule/32/16208_2.png) [@Pranil\_Ambule](https://discuss.elastic.co/u/Pranil_Ambule)\
**Post date:** [May 3, 2017, 5:58am UTC](https://discuss.elastic.co/t/logstash-xml-parser/84135/3 "2017-05-03T05:58:35Z")

</div>

Thank you Magnus.  
I found a solution, i ended up using exclude\_lines in filebeat to skip the xml fields having more than one type.

` <n1:BuildNumber>0</n1:BuildNumber>`

```
<n1:BuildNumber xsi:nil="true"/>

```

these fields were causing the problem ,so in filebeat i used exclude\_line to remove any line having

> xsi:nil="true"

This did the trick.

---

<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 31, 2017, 6:02am UTC](https://discuss.elastic.co/t/logstash-xml-parser/84135/4 "2017-05-31T06:02:11Z")

</div>

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