# Elasticsearch Split Processor preserve\_trailing value

**URL:** <https://discuss.elastic.co/t/elasticsearch-split-processor-preserve-trailing-value/274836>\
**Category:** Elasticsearch\
**Created:** [June 3, 2021, 8:41am UTC](https://discuss.elastic.co/t/elasticsearch-split-processor-preserve-trailing-value/274836 "2021-06-03T08:41:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeje232](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jeje232/32/27564_2.png) [@jeje232](https://discuss.elastic.co/u/jeje232)\
**Post date:** [June 3, 2021, 8:41am UTC](https://discuss.elastic.co/t/elasticsearch-split-processor-preserve-trailing-value/274836/1 "2021-06-03T08:41:26Z")

</div>

Hi,

I have the follwing message and try to to split values and remove at the same time the empty value with preserve\_trailing:

```auto
                          Members[
                                  xxx.xxx.xxx.xxx:xxxx
                                  xxx.xxx.xxx.xxx:xxxx
                                  xxx.xxx.xxx.xxx:xxxx
                                  xxx.xxx.xxx.xxx:xxxx
                                  xxx.xxx.xxx.xxx:xxxx
                                  xxx.xxx.xxx.xxx:xxxx

```

If I enable preserve\_trailing :

```auto

    {
      "split": {
        "field": "members_list",
        "separator": "\\n+\\s+",
        "preserve_trailing": true,
        "description": "Generate Values"
      }
    },

```

Expected result is:

```auto
          "members_list" : [
            "",
            "xxx.xxx.xxx.xxx:xxxx",
            "xxx.xxx.xxx.xxx:xxxx",
            "xxx.xxx.xxx.xxx:xxxx",
            "xxx.xxx.xxx.xxx:xxxx",
            "xxx.xxx.xxx.xxx:xxxx",
            "xxx.xxx.xxx.xxx:xxxx",
            ""
          ],

```

If I turn off preserve\_trailing I fallowing seeing empty value lines between another (first line in my case).

```auto
          "members_list" : [
            "",
            "xxx.xxx.xxx.xxx:xxxx",
            "xxx.xxx.xxx.xxx:xxxx",
            "xxx.xxx.xxx.xxx:xxxx",
            "xxx.xxx.xxx.xxx:xxxx",
            "xxx.xxx.xxx.xxx:xxxx",
            "xxx.xxx.xxx.xxx:xxxx",
          ],

```

There are form to remove this empty lines, the first one in my example?

Thank you very much,

---

<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 1, 2021, 8:42am UTC](https://discuss.elastic.co/t/elasticsearch-split-processor-preserve-trailing-value/274836/2 "2021-07-01T08:42:11Z")

</div>

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