# Create nested field with XPath

**URL:** <https://discuss.elastic.co/t/create-nested-field-with-xpath/98230>\
**Category:** Logstash\
**Created:** [August 24, 2017, 12:09pm UTC](https://discuss.elastic.co/t/create-nested-field-with-xpath/98230 "2017-08-24T12:09:06Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![cadoman](https://avatars.discourse-cdn.com/v4/letter/c/da6949/32.png) [@cadoman](https://discuss.elastic.co/u/cadoman)\
**Post date:** [August 25, 2017, 7:06am UTC](https://discuss.elastic.co/t/create-nested-field-with-xpath/98230/3 "2017-08-25T07:06:28Z")

</div>

I almost have the same problem.  
But I'm not sure that this solution could work for me :

> [@Use of Split Filter for more than 1 fields, it is possible](https://discuss.elastic.co/t/use-of-split-filter-for-more-than-1-fields-it-is-possible/97687/3):
>
> The split filter acts on a single field. You can use a ruby filter to join the elements of each array into another array so that you have this: { ... "field\_to\_split": [["A", "E", "W", "Q"], ... ] } Then feed field\_to\_split to a split filter, and use another filter or two to split the array back into discrete fields.

Right after the XML filter my fields look like this :

```
"Parameter" : {
   "EngValue" : ["1.0", "GCOM", "1.0"],
   "DecValue" : ["1.0", "1.0"]
 }

```

And I can't just join the elements of each array : For each element of "EngValue", I don't know the corresponding element in "DecValue" (since "DecValue" is optional).  
I could do it if I had this after the XML filter :

```
"Parameter" : {
   "EngValue" : ["1.0", "GCOM", "1.0"],
   "DecValue" : ["1.0", "" , "1.0"]
 }

```

Please notice that I don't want to split my values in multiple events. I want to put them in a "Parameter" array ("Parameter" is a nested object).

---

_[View the full topic](https://discuss.elastic.co/t/create-nested-field-with-xpath/98230)._
