本文整理汇总了PHP中Elasticsearch\Client::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::delete方法的具体用法?PHP Client::delete怎么用?PHP Client::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Elasticsearch\Client
的用法示例。
在下文中一共展示了Client::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* @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
}
}
示例2: delete
/**
* @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
}
}
示例3: delete
/**
* {@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;
}
}
示例4: setUpBeforeClass
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']]);
}
}
示例5: delete
/**
* 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);
}
}
}
}
}
示例6: delete
/**
* @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);
}
}
示例7: onMarkdownDocumentDeleted
public function onMarkdownDocumentDeleted(MarkdownDocumentDeletedEvent $event)
{
$params = array('id' => $event->getPath()->toAbsoluteUrlString(), 'index' => $this->index, 'type' => self::MARKDOWN_DOCUMENT_TYPE);
return $this->client->delete($params);
}
示例8:
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);
}
示例9: removeRecipeFromIndex
/**
* @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();
}
示例10: deleteStatement
/**
* Execute a update statement on index;.
*
* @param $params
*
* @return array
*/
public function deleteStatement(array $params)
{
return $this->elastic->delete($this->setStatementIndex($params));
}
示例11: delete
/**
* @param DeleteParams $params
* @return DeleteResponse
*/
public function delete(DeleteParams $params)
{
return new DeleteResponse($this->nativeClient->delete($params->toArray()));
}
示例12: delete
/**
* Delete an index.
*
* @param array $params
*
* @return array
*/
public function delete(array $params)
{
return $this->client->delete($this->prepareParams($params));
}
示例13: documentDelete
/**
* Perform an insertion into the engine.
*
* @param array $payload
* @return array
*/
public function documentDelete($payload)
{
return $this->client->delete($payload);
}
示例14: deleteDocumentFromIndex
/**
* @param Model $model
*/
public function deleteDocumentFromIndex(Model $model)
{
$this->client->delete($model);
}
示例15: removeFromIndex
/**
* @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]);
}