PHP Class Spatie\SearchIndex\SearchIndexHandlers\Elasticsearch

Inheritance: implements Spatie\SearchIndex\SearchIndexHandler
Mostrar archivo Open project: spatie/searchindex Class Usage Examples

Protected Properties

Property Type Description
$elasticsearch Elasticsearch
$indexName string

Public Methods

Method Description
__construct ( Elasticsearch\Client $elasticsearch )
clearIndex ( ) : mixed Remove everything from the index.
getClient ( ) : Elasticsearch Get the underlying client.
getResults ( array $query ) : mixed Get the results for the given query.
removeFromIndex ( Spatie\SearchIndex\Searchable $subject ) Remove the given subject from the search index.
removeFromIndexByTypeAndId ( string $type, integer $id ) Remove an item from the search index by type and id.
setIndexName ( $indexName ) Set the name of the index that should be used by default.
upsertToIndex ( Spatie\SearchIndex\Searchable | array | Traversabl\Traversable $subject ) Add or update the given searchable subject or array of subjects or Traversable object containing subjects.

Method Details

__construct() public method

public __construct ( Elasticsearch\Client $elasticsearch )
$elasticsearch Elasticsearch\Client

clearIndex() public method

Remove everything from the index.
public clearIndex ( ) : mixed
return mixed

getClient() public method

Get the underlying client.
public getClient ( ) : Elasticsearch
return Elasticsearch

getResults() public method

Get the results for the given query.
public getResults ( array $query ) : mixed
$query array
return mixed

removeFromIndex() public method

Remove the given subject from the search index.
public removeFromIndex ( Spatie\SearchIndex\Searchable $subject )
$subject Spatie\SearchIndex\Searchable

removeFromIndexByTypeAndId() public method

Remove an item from the search index by type and id.
public removeFromIndexByTypeAndId ( string $type, integer $id )
$type string
$id integer

setIndexName() public method

Set the name of the index that should be used by default.
public setIndexName ( $indexName )
$indexName

upsertToIndex() public method

Add or update the given searchable subject or array of subjects or Traversable object containing subjects.
public upsertToIndex ( Spatie\SearchIndex\Searchable | array | Traversabl\Traversable $subject )
$subject Spatie\SearchIndex\Searchable | array | Traversabl\Traversable

Property Details

$elasticsearch protected_oe property

protected Elasticsearch,Spatie\SearchIndex\SearchIndexHandlers $elasticsearch
return Elasticsearch

$indexName protected_oe property

protected string $indexName
return string