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.