Failed to establish a new connection: [Errno 111] Connection rejected (elasticsearch)

I installed elasticsearch using the following command: pip install elasticsearch After installation, I ran the following commands:

>>> from datetime import datetime
>>> from elasticsearch import Elasticsearch
# by default we connect to localhost:9200
>>> es = Elasticsearch()
# create an index in elasticsearch, ignore status code 400 (index already     exists) #but when I run this instruction:
>>> es.indices.create(index='my-index', ignore=400) // HERE IS THE PROBLEM

I get this error:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "elasticsearch/client/utils.py", line 69, in _wrapped
return func(*args, params=params, **kwargs)
File "elasticsearch/client/indices.py", line 110, in create
params=params, body=body)
File "elasticsearch/transport.py", line 327, in perform_request
status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
File "elasticsearch/connection/http_urllib3.py", line 105, in perform_request
raise ConnectionError('N/A', str(e), e)
elasticsearch.exceptions.ConnectionError:   ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f847a72ab10>:    Failed to establish a new connection: [Errno 111]     Connection refused) caused by:       NewConnectionError(<urllib3.connection.HTTPConnection object at    0x7f847a72ab10>: Failed to establish a new connection: [Errno 111] Connection    refused)
+4
source share
1 answer

What you installed is a Python client that is used to communicate between your Python script and an existing Elasticsearch cluster.

As already mentioned in your comment, at the top of the page that you started reading, it says:

Elasticsearch. - , Elasticsearch, Python; - .

() , , .

, , localhost elasticsearch 9200.

Elasticsearch , , .

+3

Source: https://habr.com/ru/post/1654326/


All Articles