# TreeMap Vega trouble create nested date for index

**URL:** <https://discuss.elastic.co/t/treemap-vega-trouble-create-nested-date-for-index/323490>\
**Category:** Kibana\
**Tags:** vega, language-clients\
**Created:** [January 19, 2023, 8:58am UTC](https://discuss.elastic.co/t/treemap-vega-trouble-create-nested-date-for-index/323490 "2023-01-19T08:58:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EugenHo](https://avatars.discourse-cdn.com/v4/letter/e/977dab/32.png) [@EugenHo](https://discuss.elastic.co/u/EugenHo)\
**Post date:** [January 19, 2023, 8:58am UTC](https://discuss.elastic.co/t/treemap-vega-trouble-create-nested-date-for-index/323490/1 "2023-01-19T08:58:37Z")

</div>

HI all,  
we have som trouble to transform data for a Treemap in vega visualization.  
I create data from Elastic like

```
{
    "_index": "eu-metricbeat-2023.01.18-000021",
    "_type": "_doc",
    "_id": "H6YsyYUBmEzuaZBQ3gRf",
    "_score": 1,
    "_source": {
      "instancename": "ENTW07",
      "instancetype": "ADS",
      "windows": {
        "service": {
          "name": "ADS_ENTW07"
        }
      }
    },
    "x0": 100,
    "y0": 50,
    "x1": 100,
    "y1": 50,
    "depth": 3,
    "children": 0
  },
  {
    "_index": "eu-metricbeat-2023.01.18-000021",
    "_type": "_doc",
    "_id": "IKYsyYUBmEzuaZBQ3gRf",
    "_score": 1,
    "_source": {
      "instancename": "ENTW20",
      "instancetype": "AMB",
      "windows": {
        "service": {
          "name": "AMB_ENTW20"
        }
      }
    },
    "x0": 100,
    "y0": 50,
    "x1": 100,
    "y1": 50,
    "depth": 3,
    "children": 0
  },
  {
    "_index": "eu-metricbeat-2023.01.18-000021",
    "_type": "_doc",
    "_id": "IaYsyYUBmEzuaZBQ3gRf",
    "_score": 1,
    "_source": {
      "instancename": "ENTW07",
      "instancetype": "AMB",
      "windows": {
        "service": {
          "name": "AMB_ENTW07"
        }
      }
    },
    "x0": 100,
    "y0": 50,
    "x1": 100,
    "y1": 50,
    "depth": 3,
    "children": 0
  },
  {
    "_index": "eu-metricbeat-2023.01.18-000021",
    "_type": "_doc",
    "_id": "IqYsyYUBmEzuaZBQ3gRf",
    "_score": 1,
    "_source": {
      "instancename": "ENTW07",
      "instancetype": "AMB",
      "windows": {
        "service": {
          "name": "AMB_ENTW07"
        }
      }
    },
    "x0": 100,
    "y0": 50,
    "x1": 100,
    "y1": 50,
    "depth": 3,
    "children": 0
  },

```

an try to create a nested group:  
vega code is:

```auto
...
  data: [
    {
      name: tree
      url: {
        index: eu-metricbeat-*
        body: {
          _source: [
            instancetype
            instancename
            windows.service.name
          ]
          size: 10
          query: {
            bool: {
              must: [
                {
                  exists: {
                    field: instancetype
                  }
                  exists: {
                    field: instancename
                  }
                }
              ]
            }
          }
        }
      }
      format: {
        property: hits.hits
      }
      transform: [
      {
        type: nest
        keys: [
        _source.instancename
        _source.instancetype 
        ]
      }
      {
        type: treemap
        method: {signal: "layout"},
        ratio: 1
        padding: 10000
        size: [200 , 100]
      }
    ] 
  }

```

the transformation

```
  transform: [
  {
    type: nest
    keys: [
    _source.instancename
    _source.instancetype 
    ]
  }

```

do not create child object and do tue this case the transformation

```auto
{
        type: treemap
        method: {signal: "layout"},
        ratio: 1
        padding: 10000
        size: [200 , 100]
      }

```

create always the same x and y values.

Any Idee whats going wrong?

---

<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:** [February 16, 2023, 8:59am UTC](https://discuss.elastic.co/t/treemap-vega-trouble-create-nested-date-for-index/323490/2 "2023-02-16T08:59:16Z")

</div>

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