How to check if an index exists in elasticsearch using a python script and perform exception handling over it? How to check if an index exists in elasticsearch using a python script and perform exception handling over it? python python

How to check if an index exists in elasticsearch using a python script and perform exception handling over it?


You have to call it on indices. Currently you are using exists of search class which tells you whether given document exists in the index and not the index itself.

Try this code

if es.indices.exists(index="index"):    Your code for search

There are also more options if you want to use.