I am new to elastic search. I am using php elastica client and facing a problem: If an index exists, I want to get the object of this existing index and not recreate it. How can this be done?
client = new \Elastica\Client($arrServerConf, $callback);
if ( $client->getIndex($name)->exists() ) {
//do something here to get this existing object -- what to do here???
} else {
// create a new one
$index = $client->getIndex($name);
$index->create(array('index' => array('number_of_shards' => $shards, 'number_of_replicas' => 0)), $delete);
}
$type = $index->getType($typeName);
Or is there some other way of doing this? I need this because, I'll be adding documents in this index and searching among them.