ldc-dam/app/Http/Traits/ElasticTrait.php

28 lines
510 B
PHP
Raw Normal View History

<?php
2022-04-19 16:07:27 +02:00
namespace App\Http\Traits;
2022-04-19 16:07:27 +02:00
use Elasticquent\ElasticquentTrait;
2022-04-19 16:07:27 +02:00
trait ElasticTrait
{
use ElasticquentTrait;
/**
* Index Exists.
*
* Does this index exist?
*
2022-04-19 16:07:27 +02:00
* @return boolean
*/
public static function indexExists()
{
2022-04-19 16:07:27 +02:00
$instance = new static();
$client = $instance->getElasticSearchClient();
$index = array(
'index' => $instance->getIndexName(),
);
return $client->indices()->exists($index);
}
}