# Kibana JSON input - String manipulation

**URL:** https://discuss.elastic.co/t/kibana-json-input-string-manipulation/68435
**Category:** Kibana
**Created:** [December 8, 2016, 12:39pm UTC](https://discuss.elastic.co/t/kibana-json-input-string-manipulation/68435 "2016-12-08T12:39:38Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Alex\_Buys](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_buys/32/13747_2.png) [@Alex\_Buys](https://discuss.elastic.co/u/Alex_Buys)
#### Post date: [December 8, 2016, 12:39pm UTC](https://discuss.elastic.co/t/kibana-json-input-string-manipulation/68435/1 "2016-12-08T12:39:38Z")

</div>

I am trying to build a visualization on Kibana to display data per day of the week. In other words, count of transactions for Monday, Tuesday, Wednesday, etc. over a duration.

I tried variations on the following JSON input filter on a histogram graph but nothing seemed to work:

```
{
  "script": "doc['@timestamp'].value.date.dayOfWeek().getAsText()"
}

```

I read somewhere that Kibana can't preform term aggregations on strings (only on numbers). Is this true?

Is it possible to retrieve the day of the week from a timestamp as depicted above in Kibana (I don't have access to ElasticSearch or logstash so I can't manipulate the data at those ends).

Using the latest version of Kibana

---

<div class="post-metadata">

### Author: ![tylersmalley](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tylersmalley/32/8833_2.png) [@tylersmalley](https://discuss.elastic.co/u/tylersmalley)
#### Post date: [December 9, 2016, 1:46am UTC](https://discuss.elastic.co/t/kibana-json-input-string-manipulation/68435/2 "2016-12-09T01:46:20Z")

</div>

Hey Alex,

Create a scripted field under the index pattern at `Management > Index Patterns`

name; `dow`  
script: `doc['@timestamp'].date.dayOfWeek`

You can then use the `dow` in term aggregations. It will be an integer, but you could further enhance the script to return the name of the week.

---

<div class="post-metadata">

### Author: ![Alex\_Buys](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_buys/32/13747_2.png) [@Alex\_Buys](https://discuss.elastic.co/u/Alex_Buys)
#### Post date: [December 9, 2016, 7:36am UTC](https://discuss.elastic.co/t/kibana-json-input-string-manipulation/68435/3 "2016-12-09T07:36:24Z")

</div>

Thank you - this solved my problem

---

<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: [January 6, 2017, 7:36am UTC](https://discuss.elastic.co/t/kibana-json-input-string-manipulation/68435/4 "2017-01-06T07:36:54Z")

</div>

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