# Access nested fields with wildcards?

**URL:** <https://discuss.elastic.co/t/access-nested-fields-with-wildcards/37160>\
**Category:** Logstash\
**Created:** [December 14, 2015, 8:03pm UTC](https://discuss.elastic.co/t/access-nested-fields-with-wildcards/37160 "2015-12-14T20:03:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![CraigFoote](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/craigfoote/32/4571_2.png) [@CraigFoote](https://discuss.elastic.co/u/CraigFoote)\
**Post date:** [December 14, 2015, 8:03pm UTC](https://discuss.elastic.co/t/access-nested-fields-with-wildcards/37160/1 "2015-12-14T20:03:10Z")

</div>

I'm using the XML filter to parse an XML log, targeting "doc":

```
filter{
    xml{
        source => "message"
        target => "doc"
    }

```

But I have some numeric fields that come through as Strings. They are not in quotes in the XML so this may be a bug. Anyway, I'm using a mutate filter to convert them to integers:  
mutate{  
add\_field =\> { "file\_size" =\> "%{[doc][Event][0][Copy][0][Source][0][File][0][Size][0]}" }  
}  
mutate{  
convert =\> { "file\_size" =\> "integer" }  
}

My problem is the XMLs can vary widely; it could be a Move or a Delete or a Rename, etc., and there could be multiple files, i.e. I could be looking at:  
`[doc][Event][0][Copy][0][Source][0][File][0][Size][1000]`

Can I reference the nested fields using wildcards? Something like:  
`[doc][Event]*[Size]*`

Any ideas appreciated.

---

<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:** [December 14, 2015, 8:23pm UTC](https://discuss.elastic.co/t/access-nested-fields-with-wildcards/37160/2 "2015-12-14T20:23:22Z")

</div>

> But I have some numeric fields that come through as Strings. They are not in quotes in the XML so this may be a bug.

No, that's the intended behavior. No XML content is parsed as integers or any other data type.

> Can I reference the nested fields using wildcards?

Nope. You'd have to implement that yourself using a ruby filter.

---

<div class="post-metadata">

**Author:** ![CraigFoote](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/craigfoote/32/4571_2.png) [@CraigFoote](https://discuss.elastic.co/u/CraigFoote)\
**Post date:** [December 14, 2015, 8:23pm UTC](https://discuss.elastic.co/t/access-nested-fields-with-wildcards/37160/3 "2015-12-14T20:23:53Z")

</div>

Ok, thanks Magnus.

---

<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:** [July 6, 2017, 5:18am UTC](https://discuss.elastic.co/t/access-nested-fields-with-wildcards/37160/4 "2017-07-06T05:18:31Z")

</div>


