client = ClientBuilder::create()->build(); } public function indexStopwords($indexName) { $stopwords = timebank_config('elasticsearch.stopwords'); $settings = [ 'analysis' => [ 'analyzer' => [ 'my_custom_analyzer' => [ 'type' => 'standard', 'stopwords' => $stopwords ] ] ] ]; // Create the index $params = [ 'index' => $indexName, 'body' => [ 'settings' => $settings, // other index settings... ] ]; $response = $this->client->indices()->create($params); return $response; } public function deleteIndex($indexName) { $client = ClientBuilder::create()->build(); $params = ['index' => $indexName, 'alias' => $indexName]; $response = $client->indices()->delete($params); return $response; } }