objectManager = $objectManager; $this->clientClass = $clientClass; $this->openSearch = $openSearch; $this->helper = $helper; } /** * Return search client * * @param array $options * @return ClientInterface */ public function create(array $options = []) { $class = $this->clientClass; if ($this->helper->isClientOpenSearchV2()) { $class = $this->openSearch; } return $this->objectManager->create( $class, ['options' => $options] ); } }