1

I tried to execute the below python code

from datetime import datetime
from elasticsearch import Elasticsearch
es = Elasticsearch()
es.indices.create(index='my-index', ignore=400)

The last statement through the below connection error.

ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 
0x0000020DC5EEF6D8>: Failed to establish a new connection: [WinError 10061] No 
connection could be made because the target machine actively refused it) caused 
by: NewConnectionError(<urllib3.connection.HTTPConnection object at 
0x0000020DC5EEF6D8>: Failed to establish a new connection: [WinError 10061] No 
connection could be made because the target machine actively refused it)
3
  • 1
    Please state explicitly what the problem is and what you are trying to do. Commented Jul 1, 2019 at 10:25
  • 2
    chan you access Elasticsearch elasticsearch:9200? Commented Jul 1, 2019 at 10:38
  • i have historical user descriptions of the issue and its resolution. I want to provide the resolution recommendation when a new issue comes in . For that when ever i get the new issue description, i want to do the elasticsearch on the historical issue descriptions and provide the quick resolution for the current issue. Commented Jul 2, 2019 at 11:24

1 Answer 1

2

It seems you have installed the only elasticsearch client library without installing the actual Elasticsearch in the computer. Thus first install Elasticsearch as follows. Download and Install

After you have downloaded a zip file(if you are using windows), into something like c:\elasticsearch-7.5.2

Go to a path like C:\elasticsearch-7.5.2\bin and run elasticsearch.bat

Then go to your browser and run http://localhost:9200/, You should get a response like enter image description here That means your elastic instance is running, so you can proceed with

es.indices.create(index='my-index', ignore=400)

In case you want a customization of the instance you can read out the tutorial Here

If you get an error of connection error while using the python elasticsearch it has already been answered Here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.