# Return value of null

**URL:** <https://discuss.elastic.co/t/return-value-of-null/113931>\
**Category:** Kibana\
**Created:** [January 3, 2018, 2:01pm UTC](https://discuss.elastic.co/t/return-value-of-null/113931 "2018-01-03T14:01:14Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)\
**Post date:** [January 4, 2018, 4:27pm UTC](https://discuss.elastic.co/t/return-value-of-null/113931/5 "2018-01-04T16:27:58Z")

</div>

Could you use `painless` instead of `groovy`

Checking for `null` seems to work there.

e.g.:

> [@Fields aggregation or field formatter?](https://discuss.elastic.co/t/fields-aggregation-or-field-formatter/87023/2):
>
> Hi Chris, I think a scripted field might help. Here's an experiment I did. I put this data using Kibana dev console. Each doc has a name but in a different field; PUT /discuss/test/1 { "date" : "2017-05-26T00:01:00", "name" : "Lee" } PUT /discuss/test/2 { "date" : "2017-05-26T00:02:00", "firstName" : "Bob" } PUT /discuss/test/3 { "date" : "2017-05-26T00:02:30", "fullName" : "Bart Simpson" } It looks like this in Discover; Obviously I can already sea…

or

> [@Finding if a Field exist using painless inline](https://discuss.elastic.co/t/finding-if-a-field-exist-using-painless-inline/96421):
>
> I'm trying to run the \_update\_by\_query to create a new field that takes a value of an existing field and adds say 1 for example. POST newlogstash/\_update\_by\_query { "script": { "lang": "painless", "inline": "if (ctx.\_source.alert.severity \> 2) {ctx.\_source.cmertic += 1;}" } } but I get the following error, and my hunch is that because the field alert.severity is not always present. So how do I check if a field exist within the inline syntax { "error": { "root\_cause": [ { "type": "sc…

for some examples

---

_[View the full topic](https://discuss.elastic.co/t/return-value-of-null/113931)._
