# How to check a doc field exist while creating scripted field using painless

**URL:** <https://discuss.elastic.co/t/how-to-check-a-doc-field-exist-while-creating-scripted-field-using-painless/74355>\
**Category:** Kibana\
**Created:** [February 8, 2017, 10:03am UTC](https://discuss.elastic.co/t/how-to-check-a-doc-field-exist-while-creating-scripted-field-using-painless/74355 "2017-02-08T10:03:59Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [May 26, 2017, 5:20pm UTC](https://discuss.elastic.co/t/how-to-check-a-doc-field-exist-while-creating-scripted-field-using-painless/74355/5 "2017-05-26T17:20:59Z")

</div>

Did you solve your issue? I just posted a response here that might help you;

> [@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…

---

_[View the full topic](https://discuss.elastic.co/t/how-to-check-a-doc-field-exist-while-creating-scripted-field-using-painless/74355)._
