Cannot import name 'Elasticsearch' from 'elasticsearch' (unknown location)

I have installed Elasticsearch library and trying to import Elasticsearch from Elasticsearch library but getting issue: cannot import name 'Elasticsearch' from 'Elasticsearch' (unknown location)

I don't think you need the first line.
import elasticsearch

However the rest looks good assuming you have installed the Elasticsearch python client already.
python3 -mpip install elasticsearch

And your not working in a folder called Elasticsearch or something similar. Python might be trying to import from the local folder.

1 Like

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