# Painless - How to return "missing value"?

**URL:** <https://discuss.elastic.co/t/painless-how-to-return-missing-value/175730>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [April 7, 2019, 7:15pm UTC](https://discuss.elastic.co/t/painless-how-to-return-missing-value/175730 "2019-04-07T19:15:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bures](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bures/32/43616_2.png) [@bures](https://discuss.elastic.co/u/bures)\
**Post date:** [April 7, 2019, 7:15pm UTC](https://discuss.elastic.co/t/painless-how-to-return-missing-value/175730/1 "2019-04-07T19:15:50Z")

</div>

Please, is there a way to return "missing value" from Painless script (in Field context)?  
I'm trying to create a scripted field that has value only if a condition holds for another field in the document. Thanks.

---

<div class="post-metadata">

**Author:** ![bures](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bures/32/43616_2.png) [@bures](https://discuss.elastic.co/u/bures)\
**Post date:** [April 7, 2019, 9:20pm UTC](https://discuss.elastic.co/t/painless-how-to-return-missing-value/175730/2 "2019-04-07T21:20:26Z")

</div>

I guess, I figured it myself. One can return empty array `return [];`. This seems to be interpreted as a "missing value".

---

<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:** [May 5, 2019, 9:20pm UTC](https://discuss.elastic.co/t/painless-how-to-return-missing-value/175730/3 "2019-05-05T21:20:39Z")

</div>

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