Week 2.

less than 1 minute read

Hello readers!

This week I had to do:

  • Research more information about Docker compose

  • Reserach about elasticserach and do my first “hello world”. I have used elasticserach in a python program where I have created my first indices. In this code:

      from elasticsearch import Elasticsearch
    
      es = Elasticsearch(HOST="http://localhost", PORT =9200)
      es = Elasticsearch()
    
      es.indices.delete(index = "second_index")
      es.indices.delete(index = "cities")
      print(es.indices.create(index = "second_index"))
      print(es.indices.exists(index = "second_index"))
    
      doc_1 = {"city": "Paris", "country":"France"}
      doc_2 = {"city": "Vienna", "country":"Austria"}
      doc_3 = {"city": "London", "country":"England"}
      print(es.index(index = "cities", doc_type = "places", id=1, body=doc_1))
      print(es.index(index = "cities", doc_type = "places", id=2, body=doc_2))
      print(es.index(index = "cities", doc_type = "places", id=3, body=doc_3))