我想在elasticsearch中检查索引是否存在。如果不存在,则应创建索引并执行其他功能。我试图找到一个解决方案,但是没有找到完美的解决方案。任何人都可以有解决此问题的任何解决方案。
我正在使用Elasticsearch库。
**$client = new Elasticsearch\Client();**
根据索引操作和源代码,以下应该工作
$client = new Elasticsearch\Client(); $indexParams['index'] = 'my_index'; $client->indices()->exists($indexParams);