# How to fetch the data from elasticsearch in query

**URL:** https://discuss.elastic.co/t/how-to-fetch-the-data-from-elasticsearch-in-query/312756
**Category:** Kibana
**Tags:** elastic-stack-reporting
**Created:** [August 24, 2022, 4:30am UTC](https://discuss.elastic.co/t/how-to-fetch-the-data-from-elasticsearch-in-query/312756 "2022-08-24T04:30:44Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Rain\_Water](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rain_water/32/98764_2.png) [@Rain\_Water](https://discuss.elastic.co/u/Rain_Water)
#### Post date: [August 24, 2022, 4:30am UTC](https://discuss.elastic.co/t/how-to-fetch-the-data-from-elasticsearch-in-query/312756/1 "2022-08-24T04:30:44Z")

</div>

Hi,  
i want to create a query to fetch the data from elasticsearch in csv can any one help me with the query.  
thanks.

---

<div class="post-metadata">

### Author: ![matschaffer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matschaffer/32/95396_2.png) [@matschaffer](https://discuss.elastic.co/u/matschaffer)
#### Post date: [August 24, 2022, 5:25am UTC](https://discuss.elastic.co/t/how-to-fetch-the-data-from-elasticsearch-in-query/312756/2 "2022-08-24T05:25:04Z")

</div>

Usually the kibana reporting feature is the way to do that so I've updated this post to go into that topic.

[Reporting and sharing | Kibana Guide [8.3] | Elastic](https://www.elastic.co/guide/en/kibana/current/reporting-getting-started.html) has information on how to use it.

---

<div class="post-metadata">

### Author: ![Rain\_Water](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rain_water/32/98764_2.png) [@Rain\_Water](https://discuss.elastic.co/u/Rain_Water)
#### Post date: [August 24, 2022, 6:30am UTC](https://discuss.elastic.co/t/how-to-fetch-the-data-from-elasticsearch-in-query/312756/3 "2022-08-24T06:30:19Z")

</div>

Sir, i don't want to export data using this feature, I want to export using a query

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [August 24, 2022, 6:46am UTC](https://discuss.elastic.co/t/how-to-fetch-the-data-from-elasticsearch-in-query/312756/4 "2022-08-24T06:46:10Z")

</div>

Queries will return data in JSON form, not CSV, so you will need to create a script to run the query and handle the conversion.

---

<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:46am UTC](https://discuss.elastic.co/t/how-to-fetch-the-data-from-elasticsearch-in-query/312756/5 "2022-09-21T06:46:26Z")

</div>

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