# How to return multiline or long list of values in painless?

**URL:** <https://discuss.elastic.co/t/how-to-return-multiline-or-long-list-of-values-in-painless/247385>\
**Category:** Elasticsearch\
**Created:** [September 3, 2020, 1:11pm UTC](https://discuss.elastic.co/t/how-to-return-multiline-or-long-list-of-values-in-painless/247385 "2020-09-03T13:11:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kelk](https://avatars.discourse-cdn.com/v4/letter/k/13edae/32.png) [@kelk](https://discuss.elastic.co/u/kelk)\
**Post date:** [September 3, 2020, 1:11pm UTC](https://discuss.elastic.co/t/how-to-return-multiline-or-long-list-of-values-in-painless/247385/1 "2020-09-03T13:11:40Z")

</div>

hi,  
I've quite a large set of key-value fields to return in the transform as below. But I wanted it to look clean and copy-paste friendly, but fails (if I put all into one line it works)

```auto
    "index_alert": {
      "transform": {
        "script": {
          "source": """
                        return [
                                     'watch_id': ctx.watch_id, 
                                     'execution_time': ctx.execution_time,
                                     'another_key1': ctx.another_val1,
                                     'another_key2': ctx.another_val2,
                                     'another_key3': ctx.another_val3
                     ]
                    """,
          "lang": "painless"
        }
      },

```

But instead if I had put into a long list, it works as below !

```auto
"source": """return ['watch_id': ctx.watch_id,'execution_time': ctx.execution_time,'another_key1': ctx.another_val1,'another_key2': ctx.another_val2,'another_key3': ctx.another_val3]"""

```

Any idea how to pass multi-line return array?

---

<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:** [October 1, 2020, 1:11pm UTC](https://discuss.elastic.co/t/how-to-return-multiline-or-long-list-of-values-in-painless/247385/2 "2020-10-01T13:11:55Z")

</div>

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