code: public function createService(ServiceLocatorInterface $serviceLocator)
      {
          $configService = $serviceLocator->get('Config');
          $params = [];
          if (isset($configService['elasticsearch'])) {
              $params = $configService['elasticsearch'];
          }
  
          return new ElasticsearchClient($params);
      }
docs: Create service
  
  @param ServiceLocatorInterface $serviceLocator
  @return mixed