# Query Option Similar to Vega Flatten Transform

**URL:** <https://discuss.elastic.co/t/query-option-similar-to-vega-flatten-transform/312835>\
**Category:** Elasticsearch\
**Created:** [August 24, 2022, 6:08pm UTC](https://discuss.elastic.co/t/query-option-similar-to-vega-flatten-transform/312835 "2022-08-24T18:08:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LisaJ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lisaj/32/108271_2.png) [@LisaJ](https://discuss.elastic.co/u/LisaJ)\
**Post date:** [August 24, 2022, 6:08pm UTC](https://discuss.elastic.co/t/query-option-similar-to-vega-flatten-transform/312835/1 "2022-08-24T18:08:18Z")

</div>

When using the Vega visualization engine to graph data, I use the flatten transform to turn a single document that contains an array of length _n_ into _n_ documents with a single element from the array.

From:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/6/862ceebb6c3c3b8dcce99d875105d192d5fd3c94.png)  
To:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/d/cd0660112170abc2f88ff2d8be13ff954b7dd12e.png)

This is great within Kibana, but others consuming the data through ES queries would like to perform the same transformation. Is there some way to transform data similarly in an ES query?

---

<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:** [September 21, 2022, 6:08pm UTC](https://discuss.elastic.co/t/query-option-similar-to-vega-flatten-transform/312835/2 "2022-09-21T18:08:36Z")

</div>

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