public function __construct(Client $client = null)
{
if (!$client) {
$client = new Client();
}
if (empty($this->_indexName)) {
throw new InvalidException('Index name has to be set');
}
if (empty($this->_typeName)) {
throw new InvalidException('Type name has to be set');
}
$this->_client = $client;
$this->_index = new Index($this->_client, $this->_indexName);
$this->_type = new BaseType($this->_index, $this->_typeName);
}