# Is it possible to preprocess source?

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-preprocess-source/50950>\
**Category:** Elasticsearch\
**Created:** [May 25, 2016, 2:44pm UTC](https://discuss.elastic.co/t/is-it-possible-to-preprocess-source/50950 "2016-05-25T14:44:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![eprst](https://avatars.discourse-cdn.com/v4/letter/e/a6a055/32.png) [@eprst](https://discuss.elastic.co/u/eprst)\
**Post date:** [May 25, 2016, 2:44pm UTC](https://discuss.elastic.co/t/is-it-possible-to-preprocess-source/50950/1 "2016-05-25T14:44:30Z")

</div>

i need to apply some filters to indexing document's field or just to source and get it filtered in query response. i know that transform is deprecated but even transfrom did not process source field. another option is to set stored field value but it also don't return field value after analyzer. Also even if i create my own plugin i can't change the source and return it. Is there any option to process document on elastic-side and return processed fields with regular query.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 26, 2016, 9:30pm UTC](https://discuss.elastic.co/t/is-it-possible-to-preprocess-source/50950/2 "2016-05-26T21:30:14Z")

</div>

You want to format fields from source when you return them in a query?

---

<div class="post-metadata">

**Author:** ![eprst](https://avatars.discourse-cdn.com/v4/letter/e/a6a055/32.png) [@eprst](https://discuss.elastic.co/u/eprst)\
**Post date:** [May 26, 2016, 10:31pm UTC](https://discuss.elastic.co/t/is-it-possible-to-preprocess-source/50950/3 "2016-05-26T22:31:00Z")

</div>

i want to filter them, for example apply html\_strip

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 27, 2016, 6:21am UTC](https://discuss.elastic.co/t/is-it-possible-to-preprocess-source/50950/4 "2016-05-27T06:21:18Z")

</div>

You cannot do that, that is not what `_source` is for. You should be doing that to fields instead.

---

<div class="post-metadata">

**Author:** ![eprst](https://avatars.discourse-cdn.com/v4/letter/e/a6a055/32.png) [@eprst](https://discuss.elastic.co/u/eprst)\
**Post date:** [May 27, 2016, 10:37am UTC](https://discuss.elastic.co/t/is-it-possible-to-preprocess-source/50950/5 "2016-05-27T10:37:43Z")

</div>

ok, then how can i return processed fields? OFC i can use "fielddata\_fields" or script but not with get api or \_mget

---

<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 5, 2017, 10:48pm UTC](https://discuss.elastic.co/t/is-it-possible-to-preprocess-source/50950/6 "2017-07-05T22:48:28Z")

</div>


