# Best way to extract a CSV with aggregations

**URL:** <https://discuss.elastic.co/t/best-way-to-extract-a-csv-with-aggregations/15871>\
**Category:** Elasticsearch\
**Created:** [February 18, 2014, 8:46am UTC](https://discuss.elastic.co/t/best-way-to-extract-a-csv-with-aggregations/15871 "2014-02-18T08:46:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_Bolis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomas_bolis/32/700_2.png) [@Thomas\_Bolis](https://discuss.elastic.co/u/Thomas_Bolis)\
**Post date:** [February 18, 2014, 8:46am UTC](https://discuss.elastic.co/t/best-way-to-extract-a-csv-with-aggregations/15871/1 "2014-02-18T08:46:30Z")

</div>

Hi,

I was wondering what is the best way to extract a csv with the various  
terms of some fields alongside with the corresponding counts? For example  
create a csv as follows:

productId, product, category, city, hour, products\_count,

> selled\_products\_count

Will cat API be useful in this case? Or I have to pass from multiple  
aggregation calls to construct this information?

Thanks  
Thomas

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6756e0e8-cf82-40b8-9bd5-8713bb85aed8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6756e0e8-cf82-40b8-9bd5-8713bb85aed8%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Binh\_Ly](https://discuss.elastic.co/u/Binh_Ly)\
**Post date:** [February 18, 2014, 4:36pm UTC](https://discuss.elastic.co/t/best-way-to-extract-a-csv-with-aggregations/15871/2 "2014-02-18T16:36:26Z")

</div>

You'll probably need to parse the JSON query results in your programming  
language to constuct a CSV result yourself. No the CAT API has a different  
purpose - it is used to display columnar views of cluster/index/node info  
and statistics - not query results.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/36ca9219-00ce-4145-a1df-bde2f5a36f09%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/36ca9219-00ce-4145-a1df-bde2f5a36f09%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 1:49am UTC](https://discuss.elastic.co/t/best-way-to-extract-a-csv-with-aggregations/15871/3 "2017-07-06T01:49:23Z")

</div>

Closed on July 6, 2017, 1:49am UTC


