# Scripted String field is not aggregatable

**URL:** <https://discuss.elastic.co/t/scripted-string-field-is-not-aggregatable/137097>\
**Category:** Kibana\
**Created:** [June 23, 2018, 3:08am UTC](https://discuss.elastic.co/t/scripted-string-field-is-not-aggregatable/137097 "2018-06-23T03:08:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![darshankumar](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@darshankumar](https://discuss.elastic.co/u/darshankumar)\
**Post date:** [June 23, 2018, 3:08am UTC](https://discuss.elastic.co/t/scripted-string-field-is-not-aggregatable/137097/1 "2018-06-23T03:08:20Z")

</div>

Hi there,

Kibana 6.2.4 - I have a scripted string field with the following config

```auto
name: matchstring
lang: painless
type: string
format: - default -
Popularity: 1
Script: 
m = /.*ElasticSearch\s.*/.matcher(doc['mymessage.keyword'].value);
if ( m.matches() ) {
   return "Search Engine";
}

```

In the discovery view, data is correctly displayed in the field, however, this field is not aggregatable as it does not show up in the aggregation fields list when building a pie chart. What am I missing?

---

<div class="post-metadata">

**Author:** ![cjcenizal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cjcenizal/32/11216_2.png) [@cjcenizal](https://discuss.elastic.co/u/cjcenizal)\
**Post date:** [June 26, 2018, 5:55pm UTC](https://discuss.elastic.co/t/scripted-string-field-is-not-aggregatable/137097/2 "2018-06-26T17:55:45Z")

</div>

Could you share a screenshot of the visualization you're trying to build so I can reproduce this? Thanks!

CJ

---

<div class="post-metadata">

**Author:** ![darshankumar](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@darshankumar](https://discuss.elastic.co/u/darshankumar)\
**Post date:** [June 27, 2018, 1:29am UTC](https://discuss.elastic.co/t/scripted-string-field-is-not-aggregatable/137097/3 "2018-06-27T01:29:46Z")

</div>

Hi CJ,

I was able to get the field to show up by typing it in. It didn't show up in the dropdown list by default (it still doesn't), not sure why.

Thanks

---

<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 25, 2018, 1:29am UTC](https://discuss.elastic.co/t/scripted-string-field-is-not-aggregatable/137097/4 "2018-07-25T01:29:51Z")

</div>

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