Esempio n. 1
0
 /**
  * Execute the request by elasticsearch client
  *
  * @param Client $client
  * @return ResponseInterface
  */
 public function executeByElasticClient(Client $client)
 {
     $responseClass = $this->getResponseClassOfRequest();
     /** @var IndexResponseInterface $response */
     $response = new $responseClass();
     $rawResult = RawResponse::build($client->index($this->toElasticClient()));
     $response = $response->build($rawResult);
     $this->getDocument()->setId($response->id());
     return $response;
 }
Esempio n. 2
0
 /**
  * Execute the request by elasticsearch client
  *
  * @param Client $client
  * @return ResponseInterface
  */
 public function executeByElasticClient(Client $client)
 {
     $params = $this->toElasticClient();
     $responseClass = $this->getResponseClassOfRequest();
     /** @var GetResponseInterface $response */
     $response = new $responseClass();
     $result = RawResponse::build($client->get($params));
     if (null !== $this->document) {
         $response->setDocument($this->document);
     }
     $response->build($result);
     return $response;
 }