# Use logstash to combine fields of nested object into one array of values

**URL:** <https://discuss.elastic.co/t/use-logstash-to-combine-fields-of-nested-object-into-one-array-of-values/67192>\
**Category:** Logstash\
**Created:** [November 25, 2016, 12:59pm UTC](https://discuss.elastic.co/t/use-logstash-to-combine-fields-of-nested-object-into-one-array-of-values/67192 "2016-11-25T12:59:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jettro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jettro/32/3418_2.png) [@jettro](https://discuss.elastic.co/u/jettro)\
**Post date:** [November 25, 2016, 12:59pm UTC](https://discuss.elastic.co/t/use-logstash-to-combine-fields-of-nested-object-into-one-array-of-values/67192/1 "2016-11-25T12:59:17Z")

</div>

Hi I am having a challenge which I did not find a solution for yet. I am using logstash to parse some input documents and I would like to do the following:

```
{
  "groups": [
    {
      "id": 1,
      "name": "one"
    },
    {
      "id": 2,
      "name": "two"
    }
  ]
}

```

I'd like this to become:

```
{
  "groups":["1-one","2-two"]
}

```

Is this possible? And if it is possible, how?

---

<div class="post-metadata">

**Author:** ![shadyabhi](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@shadyabhi](https://discuss.elastic.co/u/shadyabhi)\
**Post date:** [November 25, 2016, 3:37pm UTC](https://discuss.elastic.co/t/use-logstash-to-combine-fields-of-nested-object-into-one-array-of-values/67192/2 "2016-11-25T15:37:41Z")

</div>

If you know how to write ruby code, you can do that with the ruby filter.

I'm not answering your question directly but I had to do some manipulation of arrays the other day and this is the approach I took. [http://blog.abhijeetr.com/2016/11/logstashelasticsearch-best-way-to.html](http://blog.abhijeetr.com/2016/11/logstashelasticsearch-best-way-to.html)

I'm sure it's a good starting point and you should be able to achieve what you want to do.

---

<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:** [December 23, 2016, 3:37pm UTC](https://discuss.elastic.co/t/use-logstash-to-combine-fields-of-nested-object-into-one-array-of-values/67192/3 "2016-12-23T15:37:49Z")

</div>

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