# Vega Visualization with nested Hashes

**URL:** https://discuss.elastic.co/t/vega-visualization-with-nested-hashes/274604
**Category:** Elasticsearch
**Tags:** vega
**Created:** [June 1, 2021, 9:28am UTC](https://discuss.elastic.co/t/vega-visualization-with-nested-hashes/274604 "2021-06-01T09:28:46Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![etot94](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/etot94/32/77872_2.png) [@etot94](https://discuss.elastic.co/u/etot94)
#### Post date: [June 1, 2021, 9:28am UTC](https://discuss.elastic.co/t/vega-visualization-with-nested-hashes/274604/1 "2021-06-01T09:28:46Z")

</div>

Hello ES Team. 🙂

I would like to visualize my data from ES with Vega-lite.

My fields are:  
**data\_field** which is an array of nested hashes.  
**data\_number** which is just a number representing each of the **data\_field**

**My Example:**

**number** : 4

**data\_field** :

```
{
  "data": [
    {
      "val": 824.924,
      "string": "important"
    },
    {
      "val": 12.23,
      "string": "not_important"
    }
  ],
  "element": "first",
},
{
  "data": [
    {
      "val": 123.456,
      "string": "important"
    },
    {
      "val": 12.23,
      "string": "not_important"
    }
  ],
  "element": "second",
}

```

**My Goal:**  
I would like to create a Visualization with Vega Lite.

Is it possible to get the field **number** on the x Axis..  
and from **my\_data**  **the first** value of **val** on the y Axis\*\*?

```
         ^
         |
         |
val | .
         | . . .
         | . .
         | _______________________________________ > 
                1 2 3 4 5 6
                         number

```

**My Problem:**  
I am not sure which aggregation I should use, to get only the first **num** value of my Data.  
I would need something like the max aggregation, which returns me one of those values.. but I need not the bigger one, but the first.

Can some help me with that? 🙂

---

<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: [June 29, 2021, 9:29am UTC](https://discuss.elastic.co/t/vega-visualization-with-nested-hashes/274604/2 "2021-06-29T09:29:10Z")

</div>

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