shantanuo
shantanuo

Reputation: 32306

How to set higher timeout in a class

This works if the data is not very big. (for e.g. upto 5 MB)

import eland as ed
df = ed.DataFrame('localhost:9200', 'kibana_sample_data_flights')
df.to_csv('abc.csv')

But getting timeout error after 10 seconds if the data is large.

ConnectionTimeout: ConnectionTimeout caused by - ReadTimeoutError(HTTPSConnectionPool(host='xxx', port=xxx): Read timed out. (read timeout=10))

Is there anyway to modify default timeout in that class?

Upvotes: 0

Views: 329

Answers (2)

shantanuo
shantanuo

Reputation: 32306

This was the correct connection object that I need to include timeout.

import eland as ed
from elasticsearch import Elasticsearch

es = Elasticsearch([{"host": "localhost", "port": 9200, "timeout": 120}])
df = ed.DataFrame(es, es_index_pattern="kibana_sample_data_flights")

Upvotes: 0

JohnAlexINL
JohnAlexINL

Reputation: 626

The library eland is based on, elasticsearch, allows you to set the Timeout parameter yourself. And the PyPI page for eland elaborates on how to use eland and elasticsearch libraries together to make your requests.

You could make the request using elasticsearch and get a DataFrame object, which you then to_csv without needing to change your code very much at all.

I hope my response was helpful!

Upvotes: 1

Related Questions