Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I launch an elasticsearch instance from Python?

Please pardon me if I ask a silly question. I am completely new to programming in general.

I have installed ElasticSearch on Python using pip install elasticsearch. How do I instantiate an elastic search variable in python.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

No question is a silly question. Congratulations on starting with programming and programming in Python. I wish you all the best.

  1. The first thing you need to do to instantiate an ElasticSearch search using python is to make sure you have ElasticSearch downloaded onto your machine. Download it from here and follow the instructions to unpack.
  2. After the download, go to the terminal and enter the ElasticSearch directory cd elasticsearch-x.xx.x/ and execute .bin/elasticsearch.
  3. Once ElasticSearch is up and running, begin writing the Python script where you want to instantiate ElasticSearch instance as follows.

from elasticsearch import Elasticsearch; es = Elasticsearch( [{u'host': u'127.0.0.1', u'port': b'9200'}] )

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading