# Datatable config case help

**URL:** <https://discuss.elastic.co/t/datatable-config-case-help/68123>\
**Category:** Kibana\
**Created:** [December 6, 2016, 2:47am UTC](https://discuss.elastic.co/t/datatable-config-case-help/68123 "2016-12-06T02:47:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![joodies](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joodies/32/13630_2.png) [@joodies](https://discuss.elastic.co/u/joodies)\
**Post date:** [December 6, 2016, 2:47am UTC](https://discuss.elastic.co/t/datatable-config-case-help/68123/1 "2016-12-06T02:47:45Z")

</div>

Assuming i have data as follow in ES,  
type status  
a new  
a wip  
b new  
b new  
a done

then i need a data-table in Kibana 5.0,  
type new wip done  
a 1 1 1  
b 2 0 0

I add agg for type first, then tried add split rows and tables. can not get the result i need.

any suggestion would be appreciate.

---

<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:** [December 6, 2016, 7:22pm UTC](https://discuss.elastic.co/t/datatable-config-case-help/68123/2 "2016-12-06T19:22:43Z")

</div>

Hi Joodies,

I'm guessing `a` and `b` are values of `type`  
and `new`, `wip`, and `done` are values of `status`

So you're trying to create a data table with terms across the top and down the side. Unfortunately Kibana can't do that (yet). But I came up with a hack of a work-around.

I create test data using the Dev Tools console like this;

```auto
PUT index1/type1/1
{
  "type": "a",
  "status": "new"
}

PUT index1/type1/2
{
  "type": "a",
  "status": "wip"
}

PUT index1/type1/3
{
  "type": "b",
  "status": "new"
}

PUT index1/type1/4
{
  "type": "b",
  "status": "new"
}

PUT index1/type1/5
{
  "type": "a",
  "status": "done"
}

```

Then I created an index pattern in Kibana for `index1`.  
Then I created 3 scripted fields by going on that index pattern so that I would have a field for each of those status values that are either 1 or 0;

 ![](https://us1.discourse-cdn.com/elastic/original/2X/7/7e3f04e41f8292bd828a1fc3075f158609a85e22.png)

Then I created the Data Table visualization as shown below;

 ![](https://us1.discourse-cdn.com/elastic/original/2X/3/30822f56742fee54cdd2bd49006e62f0ec01f652.png)

Regards,  
Lee

---

<div class="post-metadata">

**Author:** ![joodies](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joodies/32/13630_2.png) [@joodies](https://discuss.elastic.co/u/joodies)\
**Post date:** [December 7, 2016, 2:09am UTC](https://discuss.elastic.co/t/datatable-config-case-help/68123/3 "2016-12-07T02:09:12Z")

</div>

Wow, you are the best!  
Thought scripted field would be slow, but tried with 5 million rows, still can be done in 1 second.  
Very good inspiration from you, thanks.

---

<div class="post-metadata">

**Author:** ![tbragin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tbragin/32/45166_2.png) [@tbragin](https://discuss.elastic.co/u/tbragin)\
**Post date:** [December 13, 2016, 8:37pm UTC](https://discuss.elastic.co/t/datatable-config-case-help/68123/4 "2016-12-13T20:37:01Z")

</div>

Btw, I just published a blog on Painless in Kibana scripted fields with examples and best practices: [https://www.elastic.co/blog/using-painless-kibana-scripted-fields](https://www.elastic.co/blog/using-painless-kibana-scripted-fields)

---

<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 10, 2017, 8:37pm UTC](https://discuss.elastic.co/t/datatable-config-case-help/68123/5 "2017-01-10T20:37:18Z")

</div>

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