Hi, to index documents with python I need to find my "host identifier". The host identifier should be in this credential page, but I don't see it anywhere. Is the first parte of the api endpoint? thanks!
Hi @A_Tran - Welcome to our community forums!
I see that you are using:
- Python client: https://github.com/elastic/app-search-python
- Elastic App Search (App Search with Elasticsearch Service (ESS))
The host_identifier
is only available in Swiftype App Search. I believe you can use API Endpoint
URL as the base_endpoint
.
@JasonStoltz - We probably need to update the documentation in https://github.com/elastic/app-search-python to include a section about Elastic App Search (with ESS). Appreciate your help Feel free to add further comments in this Discuss post in case I missed anything.
Thank you.
Thanks for all. But is not working. I tried using my Api Endpoint as you said but I get the same login error.
Tagging @JasonStoltz here, I think Romain intended this for you
That's right @jason.schultz - Thanks
Hey all,
Follow the instructions here: https://github.com/elastic/app-search-python#instantiating-a-client
And set the endpoint base to the endpoint from your screenshot:
>>> from elastic_app_search import Client
>>> client = Client(
base_endpoint='20b...{rest of your url}.found.io/api/as/v1',
api_key='your api key'
)
Be sure to omit the protocol from the base_endpoint. I will update the documentation.
Thanks Jason, but now Im getting this error:
File "C:\Python37\lib\site-packages\requests\adapters.py", line 516,
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='https',
: Max retries exceeded with url: //20becbexxx.app
s-east-1.aws.found.io/api/as/v1/engines/dequienescl/documents (Caused b
ectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x02
Failed to establish a new connection: [Errno 11004] getaddrinfo failed'
Do you have any idea why could be?
Thanks again.
Please post your exact code (but obfuscate the key and endpoint a bit so you don't give away any secrets).
Im just trying to connect by python following the git example, but im getting an error:
from elastic_app_search import Client
import requests
import jwt
client = Client(base_endpoint='https://20becbeexxxx.app-search.us-east-1.aws.found.io/api/as/v1', api_key='private-xxxx', use_https=True)
engine_name = 'dequienescl'
document = {
'id': 'INscMGmhmX4',
'body': 'A wonderful video of a magnificent cat.'
}
client.index_document(engine_name, document)
{'id': 'INscMGmhmX4'}
Make sure you exclude the https
from the base_endpoint
parameter: Not able to connect to App search from Python script
I've updated the example in the README to make that clearer. Sorry for the confusion.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.