I am attempting to create a Cognitive Search Index in Databricks. I'm using the following as a guide:
https://learn.microsoft.com/en-us/azure/search/search-get-started-python
When I execute the following code I get the error:
<urllib3.connection.HTTPSConnection object at 0x7fb54030e1c0>: Failed to establish a new connection: [Errno -2] Name or service not known
I feel this is a common error, but I can't find any solutions when I do a Google Search.
The Databricks Runtime: 9.1 LTS (includes Apache Spark 3.1.2, Scala 2.12)
My Connection is as follows:
service_name = "https://myazuredemo.search.windows.net"
admin_key = "xxxxxxxxxxxxxx"
index_name = "hotels-quickstart"
# Create an SDK client
endpoint = "https://{}.search.windows.net/".format(service_name)
admin_client = SearchIndexClient(endpoint=endpoint,
index_name=index_name,
credential=AzureKeyCredential(admin_key))
search_client = SearchClient(endpoint=endpoint,
index_name=index_name,
credential=AzureKeyCredential(admin_key))
Any thoughts?
the problem is here:
service_name = "https://myazuredemo.search.windows.net"
endpoint = "https://{}.search.windows.net/".format(service_name)
it will give you following URL:
https://https://myazuredemo.search.windows.net.search.windows.net/
so either set service_name
to myazuredemo
or just set endpoint
to https://myazuredemo.search.windows.net