Heyday\Elastica\ElasticaService
A service used to interact with elastic search.
Synopsis
class ElasticaService
{
- // constants
- const CONFIGURE_DISABLE_INDEXING = 'disable_indexing';
- const UPDATES = 'updates';
- const DELETES = 'deletes';
- // members
- private Client $client;
- private $indexName;
- private LoggerInterface $logger;
- private $indexingMemory;
- private bool $indexingMemorySet = false;
- public $searchableExtensionClassName;
- protected array $batches = ;
- // methods
- public void __construct()
- public Client getClient()
- public Index getIndex()
- protected array getIndexConfig()
- public ResultList search()
- public void createIndex()
- public void deleteIndex()
- public Response|null|bool index()
- protected bool isBatching()
- public mixed batch()
- protected int flushBatch()
- protected void batchDocument()
- public Response|null|bool remove()
- public void define()
- public void refresh()
- public array getIndexedClasses()
- protected void printActionMessage()
- protected void exception()
Hierarchy
Uses
- SilverStripe\Core\Config\Configurable
Constants
Name | Value |
---|---|
CONFIGURE_DISABLE_INDEXING | 'disable_indexing' |
UPDATES | 'updates' |
DELETES | 'deletes' |
Members
private
- $client — Elastica\Client
- $indexName — string
- $indexingMemory — string
- $indexingMemorySet — Heyday\Elastica\bool
- $logger — Psr\Log\LoggerInterface
protected
- $batches
—
array
Unprocessed batch operations.
public
- $searchableExtensionClassName
Methods
protected
- batchDocument() — Add document to batch query
- exception() — If a logger is configured, log the exception there.
- flushBatch() — Process a batch update
- getIndexConfig()
- isBatching() — Detect if we are batching queries
- printActionMessage() — Output message when item is indexed / removed
public
- __construct() — ElasticaService constructor.
- batch() — Pause all add / remove operations, batching these at the completion of a user-provided callback.
- createIndex()
- define() — Creates the index and the type mappings.
- deleteIndex() — Remove the index
- getClient()
- getIndex()
- getIndexedClasses() — Gets the classes which are indexed (i.e. have the extension applied).
- index() — Either creates or updates a record in the index.
- refresh() — Re-indexes each record in the index.
- remove()
- search() — Performs a search query and returns either a ResultList (SS template compatible) or an Elastica\ResultSet