Problem in connecting with the Elasticsearch using python Client

I am unable to connect to the ES Server to search from an index in my python jupyter notebook in first go, but if i re-run the cell it will get fetch the required data from the ES

ES version : 7.17.3
Python Elasticsearch package version: 7.12.0
Python version : 3.6

from elasticsearch import Elasticsearch

es = Elasticsearch([VN_IP], http_compress=True, timeout=3000, max_retries=10, retry_on_timeout=True)

I need to re-run the below code :

query={
    "size":0,
    "track_total_hits":True,
}

res=US_CONN.search(index="philippines_imports_data",body=query)
print(res)

Hi @Shubhankar_Satvaya,

Welcome! Can you share the error you receive when you are unable to connect?

Hello, @carly.richmond ,
It isn't showing any errors.
It just shows that your cell in the Python Jupyter notebook is in a running state.

but if I interrupt the execution of the cell and again re-run the cell, it gives the response from Elasticsearch within miliseconds.

If it is working after re run then it won't be issue of connection. Is it possible to share the notebook or any reference doc which you following ? It is hard to assume anything without knowing any error and other information. Thanks

The jupyter notebook is hosted on azure server, so i coundn't able to share the file, and also Elasticsearch is also hosted in different azure server.
but the code that was used i shared already in the above

We will be required something to debug or replicate on our side. Or you can try to connect simple connection by creating other notebook.

You can refer this elasticsearch-labs/notebooks/search/00-quick-start.ipynb at main · elastic/elasticsearch-labs · GitHub

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