# Scripted fields for match(regex)

**URL:** <https://discuss.elastic.co/t/scripted-fields-for-match-regex/129297>\
**Category:** Kibana\
**Created:** [April 24, 2018, 11:30am UTC](https://discuss.elastic.co/t/scripted-fields-for-match-regex/129297 "2018-04-24T11:30:00Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [April 24, 2018, 1:57pm UTC](https://discuss.elastic.co/t/scripted-fields-for-match-regex/129297/4 "2018-04-24T13:57:55Z")

</div>

Unfortunately, scripted fields work only on values within each individual doc. So if a doc had 3 numeric fields you could use a scripted field to add them together, or average them, or find the min, max, etc. But not across all docs or a set of docs.  
But you can also use some scripting within Visualizations in the Advanced JSON field, not sure how much it would help you as I don't know what you need to do with the value after.  
Here's an example:

> [@Display concurrency in data on Kibana](https://discuss.elastic.co/t/display-concurrency-in-data-on-kibana/26006/13):
>
> It worked for me with the following data and config: curl -XPOST 'http://localhost:9200/test3' -d '{ "settings" : { "number\_of\_shards" : 1 }, "mappings" : { "test" : { "properties" : { "start\_date" : { "type" : "date"}, "end\_date" : { "type" : "date"}, "duration" : { "type" : "integer"} } } } }' curl -XPUT 'http://localhost:9200/test3/test/1' -d '{ "start\_date" : "2015-08-23T00:0…

---

_[View the full topic](https://discuss.elastic.co/t/scripted-fields-for-match-regex/129297)._
