ldc-dam/app/Traits/Models/BindedToElasticSearch.php

31 lines
571 B
PHP
Raw Permalink Normal View History

<?php
2022-04-19 16:07:27 +02:00
namespace App\Traits\Models;
2022-04-19 16:07:27 +02:00
use Elasticquent\ElasticquentTrait;
/**
* @mixin \Elasticquent\ElasticquentTrait
*/
trait BindedToElasticSearch
2022-04-19 16:07:27 +02:00
{
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);
}
}