Skip to content

This content is for v5.0. Switch to the latest version for up-to-date documentation.

Build and Migration States

ElasticLens provides built-in Elasticsearch models to track the state of your index builds and migrations.

The IndexableBuild and IndexableMigrationLog models are Elasticsearch models that you can access directly using the Laravel-Elasticsearch package.

ElasticLens includes a built-in IndexableBuild model that allows you to monitor and track the state of your index builds.

This model records the status of each index build, providing you with insights into the indexing process.

Fields
/**
* PDPhilip\ElasticLens\Models\IndexableBuild
******Fields*******
* @property string $model // The base model being indexed.
* @property string $model_id // The ID of the base model.
* @property string $index_model // The corresponding index model.
* @property string $last_source // The last source of the build state.
* @property IndexableStateType $state // The current state of the index build.
* @property array $state_data // Additional data related to the build state.
* @property array $logs // Logs of the indexing process.
* @property Carbon $created_at // Timestamp of when the build state was created.
* @property Carbon $updated_at // Timestamp of the last update to the build state.
******Attributes*******
* @property-read string $state_name // The name of the current state.
* @property-read string $state_color // The color associated with the current state.
**/

Built-in methods include:

use PDPhilip\ElasticLens\Models\IndexableBuild;
IndexableBuild::returnState($model, $modelId, $indexModel);
IndexableBuild::countModelErrors($indexModel);
IndexableBuild::countModelRecords($indexModel);