# Watcher Transform - Replace newline character on specific field in multiple documents

**URL:** <https://discuss.elastic.co/t/watcher-transform-replace-newline-character-on-specific-field-in-multiple-documents/290479>\
**Category:** Elasticsearch\
**Tags:** painless, transforms\
**Created:** [November 29, 2021, 6:37pm UTC](https://discuss.elastic.co/t/watcher-transform-replace-newline-character-on-specific-field-in-multiple-documents/290479 "2021-11-29T18:37:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kambing](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kambing/32/45151_2.png) [@Kambing](https://discuss.elastic.co/u/Kambing)\
**Post date:** [November 29, 2021, 6:37pm UTC](https://discuss.elastic.co/t/watcher-transform-replace-newline-character-on-specific-field-in-multiple-documents/290479/1 "2021-11-29T18:37:58Z")

</div>

Hi, I'm currently building a watcher script to send data to 3rd party API, however the 3rd party API can't process the newline character ("\n") input. Some of my documents have newline character in specific field. there are usually more than 1 documents returned from "Input" query . I also use "foreach" in my watcher to send every returned documents. How can I transform the value of these specific field on every returned documents and replace the newline character with other character?

Thank you

---

<div class="post-metadata">

**Author:** ![Hendrik\_Muhs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hendrik_muhs/32/25802_2.png) [@Hendrik\_Muhs](https://discuss.elastic.co/u/Hendrik_Muhs)\
**Post date:** [November 30, 2021, 7:46am UTC](https://discuss.elastic.co/t/watcher-transform-replace-newline-character-on-specific-field-in-multiple-documents/290479/2 "2021-11-30T07:46:59Z")

</div>

Hi,

I deleted the transforms tag, because you ask about a watcher transform, not a transform provided by the [transform feature](https://www.elastic.co/guide/en/elasticsearch/reference/current/transforms.html). Unfortunately both share the same name. Sorry for the confusion.

---

<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 28, 2021, 7:47am UTC](https://discuss.elastic.co/t/watcher-transform-replace-newline-character-on-specific-field-in-multiple-documents/290479/3 "2021-12-28T07:47:37Z")

</div>

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