/**
  * @param string $identity
  */
 public function delete($identity)
 {
     try {
         $this->client->delete(['index' => $this->index, 'type' => $this->type, 'id' => $identity, 'refresh' => true]);
     } catch (Missing404Exception $e) {
         // don't care
     }
 }
 /**
  * @param string $identity
  * @return void
  */
 public function delete(string $identity)
 {
     try {
         $this->client->delete($this->createParams($identity, true));
     } catch (Missing404Exception $e) {
         // don't care if document can't be found
     }
 }
 /**
  * {@inheritdoc}
  */
 public function delete($user, $imageIdentifier)
 {
     $params = ['index' => $this->getIndexName(), 'type' => 'metadata', 'id' => $imageIdentifier];
     try {
         return (bool) $this->client->delete($params);
     } catch (Exception $e) {
         trigger_error('Elasticsearch metadata deletion failed for image: ' . $imageIdentifier, E_USER_WARNING);
         return false;
     }
 }
Esempio n. 4
0
 public static function setUpBeforeClass()
 {
     self::$kernel = static::createKernel();
     self::$kernel->boot();
     self::$elasticClient = self::$kernel->getContainer()->get('syrup.elasticsearch.client');
     self::$search = self::$kernel->getContainer()->get('syrup.elasticsearch.search');
     self::$index = self::$kernel->getContainer()->get('syrup.elasticsearch.current_component_index');
     self::$jobMapper = self::$kernel->getContainer()->get('syrup.elasticsearch.current_component_job_mapper');
     self::$sapiClient = new SapiClient(['token' => self::$kernel->getContainer()->getParameter('storage_api.test.token'), 'url' => self::$kernel->getContainer()->getParameter('storage_api.test.url'), 'userAgent' => SYRUP_APP_NAME]);
     // clear data
     $sapiData = self::$sapiClient->verifyToken();
     $projectId = $sapiData['owner']['id'];
     $jobs = self::$search->getJobs(['projectId' => $projectId, 'component' => SYRUP_APP_NAME]);
     foreach ($jobs as $job) {
         self::$elasticClient->delete(['index' => $job['_index'], 'type' => $job['_type'], 'id' => $job['id']]);
     }
 }
 /**
  * Deletes a given entity or a given list of entities
  * @param string|ElasticsearchEntity|ElasticsearchEntity[] $param either an id, an entity or a list of entities
  * @return void
  */
 public function delete($param)
 {
     if (is_string($param)) {
         $this->elasticsearchClient->delete(array('id' => $param, 'index' => $this->index, 'type' => $this->getType()));
     } else {
         if ($param instanceof ElasticsearchEntity) {
             $this->delete($param->getId());
         } else {
             if (is_array($param)) {
                 foreach ($param as $p) {
                     $this->delete($p);
                 }
             }
         }
     }
 }
Esempio n. 6
0
 /**
  * @param Searchable $type
  */
 public function delete(Searchable $type)
 {
     if (uses_trait($type, MySoftDeletes::class)) {
         //only delete when fully being deleted.
         if ($type->beingFullyDeleted()) {
             $params = $this->data($type);
             $params = array_except($params, ['body']);
             $this->client->delete($params);
         }
         //maybe we should trigger an update here instead of doing nothing.
     } else {
         //Even regular soft deletes can be deleted.
         $params = $this->data($type);
         $params = array_except($params, ['body']);
         $this->client->delete($params);
     }
 }
 public function onMarkdownDocumentDeleted(MarkdownDocumentDeletedEvent $event)
 {
     $params = array('id' => $event->getPath()->toAbsoluteUrlString(), 'index' => $this->index, 'type' => self::MARKDOWN_DOCUMENT_TYPE);
     return $this->client->delete($params);
 }
 function it_removes_a_searchable_object_from_the_index(Client $elasticsearch, Searchable $searchableObject)
 {
     $elasticsearch->delete(['index' => $this->indexName, 'type' => $this->searchableType, 'id' => $this->searchableId])->shouldBeCalled();
     $this->removeFromIndex($searchableObject);
 }
Esempio n. 9
0
 /**
  * @param Recipe $recipe
  */
 public function removeRecipeFromIndex(Recipe $recipe)
 {
     $params = ['index' => ElasticSearch::INDEX, 'type' => 'recipe', 'id' => $this->slugGenerator->generateFrom((string) $recipe->getName())];
     $this->client->delete($params);
     $this->client->indices()->refresh();
 }
Esempio n. 10
0
 /**
  * Execute a update statement on index;.
  *
  * @param $params
  *
  * @return array
  */
 public function deleteStatement(array $params)
 {
     return $this->elastic->delete($this->setStatementIndex($params));
 }
 /**
  * @param DeleteParams $params
  * @return DeleteResponse
  */
 public function delete(DeleteParams $params)
 {
     return new DeleteResponse($this->nativeClient->delete($params->toArray()));
 }
Esempio n. 12
0
 /**
  * Delete an index.
  *
  * @param array $params
  *
  * @return array
  */
 public function delete(array $params)
 {
     return $this->client->delete($this->prepareParams($params));
 }
Esempio n. 13
0
 /**
  * Perform an insertion into the engine.
  *
  * @param  array $payload
  * @return array
  */
 public function documentDelete($payload)
 {
     return $this->client->delete($payload);
 }
Esempio n. 14
0
 /**
  * @param Model $model
  */
 public function deleteDocumentFromIndex(Model $model)
 {
     $this->client->delete($model);
 }
 /**
  * @param string $type entity name
  * @param int $id entity id
  * @return array
  */
 public function removeFromIndex($type, $id)
 {
     return parent::delete(['index' => $this->index, 'type' => $type, 'id' => $id]);
 }
 /**
  * @inheritdoc
  */
 public function delete(array $params = [])
 {
     return $this->client->delete($params);
 }
Esempio n. 17
0
 /**
  * @param SavableModelInterface $model
  * @throws CouldNotPurgeException
  */
 public function purge(SavableModelInterface $model)
 {
     $params = ['index' => $this->index, 'type' => $this->type, 'id' => $model->getId()];
     $this->client->delete($params);
 }
Esempio n. 18
0
 public function it_an_object_from_the_index_by_type_and_id(Client $elasticsearch)
 {
     $elasticsearch->delete(['index' => $this->indexName, 'type' => $this->searchableType, 'id' => $this->searchableId])->shouldBeCalled();
     $this->removeFromIndexByTypeAndId($this->searchableType, $this->searchableId);
 }