abiosoft / colima

Container runtimes on macOS (and Linux) with minimal setup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker Image for Elastic search version 8.8.0 not connecting with the Application that has same Elasticsearch version

meetiasha opened this issue · comments

Description

Hi
I am running elasticsearch server of version 8.8.- using docker image. Now, I am trying to access this elastic search server from my application which is running in another docker image as below:

ELASTIC_SEARCH_SERVER = "http://host.docker.internal:9200"
db = Elasticsearch(ELASTIC_SEARCH_SERVER)

Error:
Exception in thread Thread-4 (thread_fun):
Traceback (most recent call last):
File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.11/threading.py", line 982, in run
self._target(*self._args, **self._kwargs)
File "/usecase2/multithread.py", line 13, in thread_fun
all_reports = e2e_u2(directory_path, pdf_file, question_prompt, db, all_reports)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usecase2/pickpdf.py", line 64, in e2e_u2
query_output = elastic_search(document_text, question, db)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usecase2/elasticdb.py", line 19, in elastic_search
db.index(index="pdf", id="42", body=body_doc)
File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/utils.py", line 414, in wrapped
return api(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/init.py", line 2318, in index
return self.perform_request( # type: ignore[return-value]
Exception in thread Thread-3 (thread_fun):
Traceback (most recent call last):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/_base.py", line 285, in perform_request
meta, resp_body = self.transport.perform_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
self.run()
File "/usr/local/lib/python3.11/site-packages/elastic_transport/_transport.py", line 328, in perform_request
File "/usr/local/lib/python3.11/threading.py", line 982, in run
meta, raw_data = node.perform_request(
self._target(*self._args, **self._kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usecase2/multithread.py", line 13, in thread_fun
File "/usr/local/lib/python3.11/site-packages/elastic_transport/_node/_http_urllib3.py", line 202, in perform_request
all_reports = e2e_u2(directory_path, pdf_file, question_prompt, db, all_reports)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usecase2/pickpdf.py", line 64, in e2e_u2
query_output = elastic_search(document_text, question, db)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usecase2/elasticdb.py", line 19, in elastic_search
db.index(index="pdf", id="42", body=body_doc)
raise err from None
File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/utils.py", line 414, in wrapped
elastic_transport.ConnectionError: Connection error caused by: ConnectionError(Connection error caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f77f16a2d50>: Failed to establish a new connection: [Errno 111] Connection refused))
return api(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/init.py", line 2318, in index
return self.perform_request( # type: ignore[return-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/_base.py", line 285, in perform_request
meta, resp_body = self.transport.perform_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/elastic_transport/_transport.py", line 328, in perform_request
meta, raw_data = node.perform_request(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/elastic_transport/_node/_http_urllib3.py", line 202, in perform_request
raise err from None
elastic_transport.ConnectionError: Connection error caused by: ConnectionError(Connection error caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f77f16a3e10>: Failed to establish a new connection: [Errno 111] Connection refused))
172.17.0.1 - - [09/Feb/2024 11:50:13] "POST /text_summary HTTP/1.1" 500 -
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1488, in call
return self.wsgi_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1466, in wsgi_app
response = self.handle_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1463, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 872, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 870, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 855, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usecase2/u2_app.py", line 71, in text_summary
e2e_result = start_process_e2e(user_text, directory_path, asset_names)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usecase2/u2_app.py", line 42, in start_process_e2e
final_summary_dict = summary_all_reports(summarized_final_output, db1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usecase2/summary.py", line 19, in summary_all_reports
db1.index(index="pdf", id="42", body=body_doc)
File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/utils.py", line 414, in wrapped
return api(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/init.py", line 2318, in index
return self.perform_request( # type: ignore[return-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/elasticsearch/_sync/client/_base.py", line 285, in perform_request
meta, resp_body = self.transport.perform_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/elastic_transport/_transport.py", line 328, in perform_request
meta, raw_data = node.perform_request(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/elastic_transport/_node/_http_urllib3.py", line 202, in perform_request
raise err from None
elastic_transport.ConnectionError: Connection error caused by: ConnectionError(Connection error caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f77f1a6aa10>: Failed to establish a new connection: [Errno 111] Connection refused))

So, I tried to debug this further by executing below command from inside my application docker container:
curl http://host.docker.internal:9200

Please let me know if there are any known issues here.

Version

No response

Operating System

  • macOS Intel <= 13 (Ventura)
  • macOS Intel >= 14 (Sonoma)
  • Apple Silicon <= 13 (Ventura)
  • Apple Silicon >= 14 (Sonoma)
  • Linux

Output of colima status

No response

Reproduction Steps

Expected behaviour

No response

Additional context

No response