# How to map rows into columns in visualization data table?

**URL:** <https://discuss.elastic.co/t/how-to-map-rows-into-columns-in-visualization-data-table/186664>\
**Category:** Kibana\
**Created:** [June 20, 2019, 11:03am UTC](https://discuss.elastic.co/t/how-to-map-rows-into-columns-in-visualization-data-table/186664 "2019-06-20T11:03:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![YuWatanabe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuwatanabe/32/13259_2.png) [@YuWatanabe](https://discuss.elastic.co/u/YuWatanabe)\
**Post date:** [June 20, 2019, 11:03am UTC](https://discuss.elastic.co/t/how-to-map-rows-into-columns-in-visualization-data-table/186664/1 "2019-06-20T11:03:59Z")

</div>

Hello.

I would like to ask question which is similar to the one below but since there was no answer to it, I'd like ask again including examples.

> [@Convert rows into columns in Kibana from Visualize tab](https://discuss.elastic.co/t/convert-rows-into-columns-in-kibana-from-visualize-tab/98023):
>
> How can I convert rows into columns in Kibana ? Can I generate a pivot table-like in Kibana ? Can someone provide a guide please ? Thanks & Regards,

I have a table as below in kibana (7.1.1). This is created by simple _terms aggregation_

 ![vis](https://us1.discourse-cdn.com/elastic/original/3X/6/5/65426949c0952f2d21b6467e75814f55f983a58d.png)

My goal is to create data table as below .

```
A effective_img speed_limit
000015_0_tsr.AVI 3 3
000013_0_tsr.AVI 0 4

```

Is this possible ?

---

<div class="post-metadata">

**Author:** ![YuWatanabe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuwatanabe/32/13259_2.png) [@YuWatanabe](https://discuss.elastic.co/u/YuWatanabe)\
**Post date:** [June 21, 2019, 2:17am UTC](https://discuss.elastic.co/t/how-to-map-rows-into-columns-in-visualization-data-table/186664/2 "2019-06-21T02:17:46Z")

</div>

The _aggregation_ I am trying to achieve is below.  
What I am trying to do here is map _B_ and _C_ to different _columns_ rather than expanding _rows_. I could do this in _Canvas_ but would like to use user friendly vis table instead .

**Aggs**

```
GET tags/_search
{
  "size": 0,
  "aggs": {
    "A": {
      "terms": { "field": "avi.name", "size": 2 },
      "aggs": {
        "B": {
          "filter": { "term": { "shape.model": "effective_img" } },
          "aggs": { "B-1": { "terms": { "field": "shape.model" } } }
        },
        "C": {
          "filter": { "term": { "shape.model": "speed_limit" } },
          "aggs": { "C-1": { "terms": { "field": "shape.model" } } }
        }
      }
    }
  }
}

```

**RESULT**

```
{
  "took" : 52,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1770,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : []
  },
  "aggregations" : {
    "A" : {
      "doc_count_error_upper_bound" : 0,
      "sum_other_doc_count" : 1231,
      "buckets" : [
        {
          "key" : "000049_0_tsr.AVI",
          "doc_count" : 285,
          "B" : {
            "doc_count" : 0,
            "B-1" : {
              "doc_count_error_upper_bound" : 0,
              "sum_other_doc_count" : 0,
              "buckets" : []
            }
          },
          "C" : {
            "doc_count" : 39,
            "C-1" : {
              "doc_count_error_upper_bound" : 0,
              "sum_other_doc_count" : 0,
              "buckets" : [
                {
                  "key" : "speed_limit",
                  "doc_count" : 39
                }
              ]
            }
          }
        },
        {
          "key" : "000028_1_tsr.AVI",
          "doc_count" : 254,
          "B" : {
            "doc_count" : 0,
            "B-1" : {
              "doc_count_error_upper_bound" : 0,
              "sum_other_doc_count" : 0,
              "buckets" : []
            }
          },
          "C" : {
            "doc_count" : 32,
            "C-1" : {
              "doc_count_error_upper_bound" : 0,
              "sum_other_doc_count" : 0,
              "buckets" : [
                {
                  "key" : "speed_limit",
                  "doc_count" : 32
                }
              ]
            }
          }
        }
      ]
    }
  }
}
```

---

<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 19, 2019, 2:17am UTC](https://discuss.elastic.co/t/how-to-map-rows-into-columns-in-visualization-data-table/186664/3 "2019-07-19T02:17:50Z")

</div>

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