1

I'm using Python script that fetch data from Rally API, manipulate it and send to Elasticsearch. I'm trying to figure how to find my exist index/s in script code. My ES instance is quite simple:

es = Elasticsearch([{'host': 'myIP', 'port': 9200}])

I cannot find where's exist index in this instance

My purpose is to state a condition for updating my index/s data

Any idea?

tnx

Aviv Cohen
  • 69
  • 6

1 Answers1

1

OK I found the solution and it's quite simple to use. Just type:

from elasticsearch import Elasticsearch 

es = Elasticsearch([{'host': 'host_ip', 'port': 9200}])

if es.indices.exists(index = 'index_name') 
 #set a condition here
Aviv Cohen
  • 69
  • 6