Hello!
We have a problem connecting to our App Search engine from python using the elastic_app_search library. After creating a client instance with our proper credentials the server is rejecting to output anything. For illustration I am using the get_schema method.
HTTPConnectionPool(host='https', port=...): Max retries exceeded with url: //... /our_engine/schema (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at ...>: Failed to establish a new connection: [Errno -2] Name or service not known',))
Is there anything we need to adjust in the App search settings to allow it? We should definitely not exceed any limit as we were not connected never before.
The weird thing is that from javascript the connection works fine.
Can you please check the value of base_endpoint doesn't contain http:// or https://?
Also, does the host where the python code runs has access to the endpoint? Can you try with a curl?
so I removed the https:// part from the endpoint, that was probably the cause. But ended up with another exception elastic_app_search.exceptions.NonExistentRecord. Is it good?
With curl I was able to reach the endpoint in https:// format with response "You are being redirected" to the login page.
The methods I am calling on the Client instance - list_engines, create_engine, get_documents.
In App Search, everything is set up and the engine whose name I am passing to the client contains data which I put there as a json file. I am pretty sure I am entering right engine name - the one that is displayed in App Search under Engines.
Checking the code, the only way to get NonExistentRecord is when the request returns HTTP 404.
As the library uses requests library, if you're using Python 3, you can add this at the beginning of your script to log the requests (from StackOverflow). Some details will be in requests.log, others in stdout.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.