Skip to content

Commit fd84a1a

Browse files
committed
Changing to use endpoint instead of cloud id, and removing unused os reference
1 parent 3702553 commit fd84a1a

File tree

1 file changed

+17
-34
lines changed

1 file changed

+17
-34
lines changed

supporting-blog-content/multilingual-embedding/multilingual_embedding.ipynb

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"source": [
2626
"import requests\n",
2727
"import json\n",
28-
"import os\n",
2928
"\n",
3029
"### Download multilingual coco dataset\n",
3130
"### Here we are retrieving first 100 rows for this example\n",
@@ -54,21 +53,29 @@
5453
},
5554
{
5655
"cell_type": "code",
57-
"execution_count": null,
56+
"execution_count": 3,
5857
"metadata": {},
59-
"outputs": [],
58+
"outputs": [
59+
{
60+
"name": "stdout",
61+
"output_type": "stream",
62+
"text": [
63+
"Enter your Elasticsearch credentials:\n"
64+
]
65+
}
66+
],
6067
"source": [
6168
"from getpass import getpass\n",
6269
"\n",
6370
"# Get credentials securely for localhost Elasticsearch\n",
6471
"print(\"Enter your Elasticsearch credentials:\")\n",
65-
"cloud_id = input(\"Enter your cloud_id: \")\n",
66-
"api_key = getpass(\"Enter your api_key: \")"
72+
"elastic_endpoint = input(\"Enter your Elastic endpoint: \")\n",
73+
"api_key = getpass(\"Enter your API key: \")"
6774
]
6875
},
6976
{
7077
"cell_type": "code",
71-
"execution_count": null,
78+
"execution_count": 5,
7279
"metadata": {},
7380
"outputs": [
7481
{
@@ -77,29 +84,15 @@
7784
"text": [
7885
"Successfully connected to Elasticsearch\n"
7986
]
80-
},
81-
{
82-
"name": "stderr",
83-
"output_type": "stream",
84-
"text": [
85-
"/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/elasticsearch/_sync/client/__init__.py:311: SecurityWarning: Connecting to 'https://localhost:9200' using TLS with verify_certs=False is insecure\n",
86-
" _transport = transport_class(\n",
87-
"/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'localhost'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
88-
" warnings.warn(\n"
89-
]
9087
}
9188
],
9289
"source": [
9390
"from elasticsearch import Elasticsearch\n",
9491
"\n",
9592
"try:\n",
9693
" es = Elasticsearch(\n",
97-
" hosts=[{\"host\": \"localhost\", \"port\": 9200, \"scheme\": \"https\"}],\n",
98-
" basic_auth=(\"elastic\", \"qaf_admin\"),\n",
99-
" verify_certs=False, # Set to True if you have valid SSL certificates\n",
100-
" # Alternatively, you can use Elastic cloud_id and api_key\n",
101-
" # api_key=getpass(\"API Key: \")\n",
102-
" # cloud_id=getpass(\"Cloud ID: \"),\n",
94+
" hosts=[elastic_endpoint],\n",
95+
" api_key=api_key\n",
10396
" )\n",
10497
"\n",
10598
" # Test the connection\n",
@@ -116,7 +109,7 @@
116109
},
117110
{
118111
"cell_type": "code",
119-
"execution_count": 16,
112+
"execution_count": 6,
120113
"metadata": {},
121114
"outputs": [
122115
{
@@ -126,16 +119,6 @@
126119
"Successfully bulk indexed 4840 documents\n",
127120
"Indexing complete!\n"
128121
]
129-
},
130-
{
131-
"name": "stderr",
132-
"output_type": "stream",
133-
"text": [
134-
"/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'localhost'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
135-
" warnings.warn(\n",
136-
"/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/urllib3/connectionpool.py:1099: InsecureRequestWarning: Unverified HTTPS request is being made to host 'localhost'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings\n",
137-
" warnings.warn(\n"
138-
]
139122
}
140123
],
141124
"source": [
@@ -227,7 +210,7 @@
227210
"name": "python",
228211
"nbconvert_exporter": "python",
229212
"pygments_lexer": "ipython3",
230-
"version": "3.11.6"
213+
"version": "3.12.10"
231214
}
232215
},
233216
"nbformat": 4,

0 commit comments

Comments
 (0)