Check if the index exists or not Elasticsearch

I want to check in elasticsearch if the index exists or not. If it not exists it should create the index and do other functionality. I try to find out a solution for that, but did not find any perfect solution for that. Can anyone have any solution to solve this problem.

I am using Elasticsearch library.

**$client = new ElasticsearchClient();**


As per index operations and source code the following should work

 $client = new ElasticsearchClient();
 $indexParams['index']  = 'my_index';   

Leave a Reply

Your email address will not be published. Required fields are marked *