# How to determine a field type using painless

**URL:** <https://discuss.elastic.co/t/how-to-determine-a-field-type-using-painless/132732>\
**Category:** Elasticsearch\
**Created:** [May 22, 2018, 7:14am UTC](https://discuss.elastic.co/t/how-to-determine-a-field-type-using-painless/132732 "2018-05-22T07:14:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniellienert](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daniellienert/32/31435_2.png) [@daniellienert](https://discuss.elastic.co/u/daniellienert)\
**Post date:** [May 22, 2018, 7:14am UTC](https://discuss.elastic.co/t/how-to-determine-a-field-type-using-painless/132732/1 "2018-05-22T07:14:38Z")

</div>

Hey,

I am running Elasticsearch 5.6.8.

In my script in an UPDATE, I assume a field being a HasMap, but I got an error like:

`Caused by: java.lang.IllegalArgumentException: Unable to find dynamic method [containsKey] with [1] arguments for class [java.util.ArrayList].`

Is it possible to determine the type of a `ctx._source.*` field with painless, so I can react accordingly?

Thanks in advance,  
Daniel

---

<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:** [June 19, 2018, 7:14am UTC](https://discuss.elastic.co/t/how-to-determine-a-field-type-using-painless/132732/2 "2018-06-19T07:14:43Z")

</div>

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