Kohimax / qna-api

https://kohinoor-soubam.medium.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ElasticsearchDocumentStore Internal Server Error

HyunWinter opened this issue · comments

commented

Hello Kohimax,

Thank you for posting the guides on Medium.com! I got QNA API to run on localhost:8777 but can't seem to load data from the API. I'm suspecting it has something to do with the Elasticsearch Server and DocumentStore function. Can you help me find what I'm doing wrong?

Untitled1
Untitled4
Capture
Capture1

Thank you.

hi @HyunWinter I have seen your host address configure as 0.0.0.0 due to this the below internal issue encountered:

"500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application."

Please change to your machine IP address instead of "0.0.0.0",
example :
app.config["host"] = "172.78.5.8"

I hope this will resolved the issue.
Thanks.

commented

I changed the host address to 172.xxx.xx.xxx/localhost and relocated the directory paths using
os.path.dirname(os.path.abspath(__file__))
Now everything works perfectly. Thank you so much @Kohimax for the help and awesome guide! 😄

I have the same error but it gives me this error here in logs:
File "/opt/conda/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/usr/src/app/main.py", line 68, in update_document document_store = ElasticsearchDocumentStore(host=app.config["host"], File "/opt/conda/lib/python3.8/site-packages/haystack/document_store/elasticsearch.py", line 119, in __init__ self._create_document_index(index) File "/opt/conda/lib/python3.8/site-packages/haystack/document_store/elasticsearch.py", line 131, in _create_document_index if self.client.indices.exists(index=index_name): File "/opt/conda/lib/python3.8/site-packages/elasticsearch/client/utils.py", line 152, in _wrapped return func(*args, params=params, headers=headers, **kwargs) File "/opt/conda/lib/python3.8/site-packages/elasticsearch/client/indices.py", line 330, in exists return self.transport.perform_request( File "/opt/conda/lib/python3.8/site-packages/elasticsearch/transport.py", line 390, in perform_request raise e File "/opt/conda/lib/python3.8/site-packages/elasticsearch/transport.py", line 358, in perform_request status, headers_response, data = connection.perform_request( File "/opt/conda/lib/python3.8/site-packages/elasticsearch/connection/http_urllib3.py", line 258, in perform_request raise ConnectionError("N/A", str(e), e) elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f83d3f26f70>: Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f83d3f26f70>: Failed to establish a new connection: [Errno 111] Connection refused)
I have tried using my machine IP but that didn't work