Exemplo n.º 1
0
 /**
  * Delete all indices
  */
 public function deleteAllIndices()
 {
     /** @var ClassMetadata[] $metadatas */
     $metadatas = $this->sm->getMetadataFactory()->getAllMetadata();
     foreach ($metadatas as $metadata) {
         try {
             $this->client->deleteIndex($metadata->getIndexForRead());
         } catch (ResponseException $e) {
             if (strpos($e->getResponse()->getError(), 'IndexMissingException') === false) {
                 // The original error from ES is not "IndexMissingException". We shouldn't swallow it.
                 throw $e;
             }
             // The index has been deleted already, skip it.
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Generate filter used by generateQueryBy()
  *
  * @param array $criteria
  *
  * @return BoolAnd
  * @throws InvalidArgumentException
  * @throws \Exception
  */
 public function generateFilterBy(array $criteria)
 {
     return $this->client->generateFilterBy($criteria);
 }