# Split JSON array into multiple events using ingest pipelines?

**URL:** <https://discuss.elastic.co/t/split-json-array-into-multiple-events-using-ingest-pipelines/238519>\
**Category:** Elasticsearch\
**Created:** [June 24, 2020, 3:13pm UTC](https://discuss.elastic.co/t/split-json-array-into-multiple-events-using-ingest-pipelines/238519 "2020-06-24T15:13:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ianmuscat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ianmuscat/32/71034_2.png) [@ianmuscat](https://discuss.elastic.co/u/ianmuscat)\
**Post date:** [June 24, 2020, 3:13pm UTC](https://discuss.elastic.co/t/split-json-array-into-multiple-events-using-ingest-pipelines/238519/1 "2020-06-24T15:13:14Z")

</div>

I have some logs being forwarded using Filebeat to Elasticsearch which contain a JSON array.

```auto
{
  "docs": [
    {
      "_source": {
        ...
        "snapshot": [
          {
            "address": "127.0.0.1",
            "interface": "lo",
            "mac": "00:00:00:00:00:00"
          },
          {
            "address": "::1",
            "mac": "00:00:00:00:00:00",
            "interface": "lo"
          },
        ]
        ...
      }
    }
  ]
}

```

I need to use this data in Kibana and as such, given that from what I read Kibana does not deal nicely with arrays ([How to visualize JSON array in Kibana](https://discuss.elastic.co/t/how-to-visualize-json-array-in-kibana/145260/2)), I would like to store each array item within the `snapshot` array as it's own event in Elasticsearch, presumably looking something similar to the following.

```auto

{
  "docs": [
    {
      "_source": {
        ...
        "snapshot": {
        	"address": "127.0.0.1",
        	"interface": "lo",
        	"mac": "00:00:00:00:00:00"
        }
        ...
      }
    },
    {
      "_source": {
        ...
        "snapshot": {
        	"address": "::1",
        	"mac": "00:00:00:00:00:00",
        	"interface": "lo"
        }
        ...
      }
    }
  ]
}

```

While this seems to be possible using Logstash ([https://stackoverflow.com/questions/31402997/how-to-split-a-json-array-inside-an-object](https://stackoverflow.com/questions/31402997/how-to-split-a-json-array-inside-an-object)) using the `split` filter, I can't seem to find an obvious way to do this using Elasticsearch ingest pipelines (the `split` processor in Elasticsearch ingest pipelines seems to only operate on strings).

Any help would be most appreciated.

---

<div class="post-metadata">

**Author:** ![ianmuscat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ianmuscat/32/71034_2.png) [@ianmuscat](https://discuss.elastic.co/u/ianmuscat)\
**Post date:** [June 25, 2020, 9:33am UTC](https://discuss.elastic.co/t/split-json-array-into-multiple-events-using-ingest-pipelines/238519/2 "2020-06-25T09:33:46Z")

</div>

Unfortunately, this seems to not be possible at the moment (see [https://github.com/elastic/elasticsearch/issues/56769](https://github.com/elastic/elasticsearch/issues/56769))

---

<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 23, 2020, 9:33am UTC](https://discuss.elastic.co/t/split-json-array-into-multiple-events-using-ingest-pipelines/238519/3 "2020-07-23T09:33:59Z")

</div>

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