# Timeout for exporting csv in ES|QL

**URL:** https://discuss.elastic.co/t/timeout-for-exporting-csv-in-es-ql/372350
**Category:** Kibana
**Created:** [December 24, 2024, 7:28am UTC](https://discuss.elastic.co/t/timeout-for-exporting-csv-in-es-ql/372350 "2024-12-24T07:28:51Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![petition2307](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@petition2307](https://discuss.elastic.co/u/petition2307)
#### Post date: [December 24, 2024, 7:28am UTC](https://discuss.elastic.co/t/timeout-for-exporting-csv-in-es-ql/372350/1 "2024-12-24T07:28:51Z")

</div>

I'm an Elasticsearch beginner.  
I have a problem about exporting csv in ES|QL.

# Environment

OS: Debian 12  
Elasticsearch Version: 8.15.2 (elasticsearch and kibana)

# Problem

I tried exporting csv and got timeout error.  
The message was as bellow.

```auto
Report contains warnings

Encountered an unknown error: Request timed out
Output
Status
Completed
Kibana version
8.15.2
Attempts
1 of 3
Content type
text/csv
Size in bytes
0
CSV rows
0
Search strategy
scroll
Report job ID
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Processed by
hostname (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
Timeout
3600 seconds

Timestamps
Time zone
Asia/Tokyo
Created at
2024-12-24T15:31:29.928+09:00
Started at
2024-12-24T15:31:32.401+09:00
Completed at
2024-12-24T15:32:04.304+09:00
Queue time
2.473 seconds
Execution time
31.903 seconds

```

I had changed the following parameters in kibana.yml but got the error yet.

```auto
xpack.reporting.queue.timeout: 3600000
xpack.reporting.csv.scroll.strategy: scroll

```

I want to get the result in csv format.  
What should I do?

---

<div class="post-metadata">

### Author: ![jessgarson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jessgarson/32/129841_2.png) [@jessgarson](https://discuss.elastic.co/u/jessgarson)
#### Post date: [January 6, 2025, 7:15pm UTC](https://discuss.elastic.co/t/timeout-for-exporting-csv-in-es-ql/372350/2 "2025-01-06T19:15:49Z")

</div>

Thanks for reaching out, @petition2307. I have a few follow-up questions here:

- Do you have a sample of the query you were running?
- How were you exporting the CSV?

Best,

Jessica

---

<div class="post-metadata">

### Author: ![petition2307](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@petition2307](https://discuss.elastic.co/u/petition2307)
#### Post date: [January 7, 2025, 8:16am UTC](https://discuss.elastic.co/t/timeout-for-exporting-csv-in-es-ql/372350/3 "2025-01-07T08:16:51Z")

</div>

Thank you for your reply.

> Do you have a sample of the query you were running?

```auto
FROM sample-index_* METADATA _index, _id
| WHERE hostname IN ("AAAAAA","BBBBBB","CCCCCC","DDDDDD","EEEEEE","FFFFFF","GGGGGG","HHHHHH","IIIIII","JJJJJJ","KKKKKK","LLLLLL","MMMMMM","NNNNNN","OOOOOO","PPPPPP","QQQQQQ","RRRRRR")
| STATS mintime=MIN(@timestamp),maxtime=MAX(@timestamp) BY hostname,fieldA
| SORT mintime ASC

```

The total rows are 151.

> How were you exporting the CSV?

After the search result has been displayed, I accessed as belows.  
share -\> Export -\> Generate CSV -\> "[Stack Management \> Reporting]"

If you have any questions, please feel free to ask me.

Best Regards,

---

<div class="post-metadata">

### Author: ![jessgarson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jessgarson/32/129841_2.png) [@jessgarson](https://discuss.elastic.co/u/jessgarson)
#### Post date: [January 7, 2025, 5:09pm UTC](https://discuss.elastic.co/t/timeout-for-exporting-csv-in-es-ql/372350/4 "2025-01-07T17:09:27Z")

</div>

Thanks @petition2307,

You could try specifying the format directly in Dev Tools:

```auto
POST _query?format=csv
{
  "query": """
from sample-index_*
| where hostname in ("AAAAAA", "BBBBBB", "CCCCCC", "DDDDDD", "EEEEEE", "FFFFFF", "GGGGGG", "HHHHHH", "IIIIII", "JJJJJJ", "KKKKKK", "LLLLLL", "MMMMMM", "NNNNNN", "OOOOOO", "PPPPPP", "QQQQQQ", "RRRRRR")
| stats mintime = min(@timestamp), maxtime = max(@timestamp) by hostname, fieldA
| sort mintime asc
  """
}

```

---

<div class="post-metadata">

### Author: ![petition2307](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@petition2307](https://discuss.elastic.co/u/petition2307)
#### Post date: [January 8, 2025, 12:05am UTC](https://discuss.elastic.co/t/timeout-for-exporting-csv-in-es-ql/372350/5 "2025-01-08T00:05:07Z")

</div>

Thank you, but I had already tried that.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/4/94b847fa6f0ce109588d02e8ee2cd2adf4a2da48.png)

I tried query async API, but it is not compatible with format=csv...

Best Regards,

---

<div class="post-metadata">

### Author: ![jessgarson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jessgarson/32/129841_2.png) [@jessgarson](https://discuss.elastic.co/u/jessgarson)
#### Post date: [January 8, 2025, 9:35pm UTC](https://discuss.elastic.co/t/timeout-for-exporting-csv-in-es-ql/372350/6 "2025-01-08T21:35:12Z")

</div>

Thanks for following up, @petition2307. Did you try it without the async API? Another workaround I thought of was running it in Python as described in [this post](https://www.elastic.co/search-labs/blog/esql-pandas-native-dataframes-python) and exporting from there.
