pdphilip/elasticlens
ElasticLens brings Elasticsearch power to Laravel models with Eloquent-style queries. Define your own index models, mappings, and schema—no black box. Run phrase/term searches, filters, embedded fields, geo distance sorting, and pagination with fluent, readable APIs.
This release is compatible with Laravel 10, 11 & 12
The engine has been rewritten from the ground up. The core indexing, observer, and build systems were gutted and rebuilt with cleaner internals, typed signatures, and proper error boundaries. The package now has a full test suite (unit + integration) running against a real Elasticsearch instance in CI - something that didn't exist before.
Full documentation now lives at elasticlens.pdphilip.com
viaIndex()->get() now returns base models directly - no more getBase() neededexcludeIndex()viaIndex()->get() returns base model collection (was index model collection; use ->get() directly instead of ->getBase())getBase() and paginateBase() still work but are no longer necessary for the default casegetIndex() and paginateIndex() if you would like to return the index values directlyFull Changelog: https://github.com/pdphilip/elasticlens/compare/v3.1.2...v4.0.0
This release is compatible with Laravel 10, 11 & 12
removeIndex() method and ensure bool is returnedFull Changelog: https://github.com/pdphilip/elasticlens/compare/v3.1.2...v3.1.2
This release is compatible with Laravel 10, 11 & 12
IndexableBuild::buildErrorsQuery($indexModel) - returns a query prepared for failed builds of an index-model$buildErrors = IndexableBuild::buildErrorsQuery(IndexedUser::class)->get();
Full Changelog: https://github.com/pdphilip/elasticlens/compare/v3.1.0...v3.1.1
This release is compatible with Laravel 10, 11 & 12
Index-Model with the protected int $buildChunkRate propertyclass IndexedUser extends IndexModel
{
protected int $buildChunkRate = 2000;
lens:migration and lens:build commands. If there are any migration errors in the migrationMap() method then it will be shown - via issue #6Full Changelog: https://github.com/pdphilip/elasticlens/compare/v3.0.3...v3.1.0
paginateBase() bug. Fixed issue where subsequent paging returned data (items) as non-sequential arrays.Full Changelog: https://github.com/pdphilip/elasticlens/compare/v3.0.2...v3.0.3
Full Changelog: https://github.com/pdphilip/elasticlens/compare/v3.0.1...v3.0.2
This release is compatible with Laravel 10, 11 & 12
excludeIndex(): bool method in your base model$user->removeIndex()IndexedUser::whereIndexBuilds()->get() - returns index build logs for modelIndexedUser::whereFailedIndexBuilds()->get() - returns failed index build logs for modelIndexedUser::whereMigrations()->get() - returns migration logs for modelIndexedUser::whereMigrationErrors()->get() - returns failed migrations for modelIndexedUser::lensHealth() - returns an array of the index healthsearch() runs searchPhrasePrefix() under the hoodpaginateBase() honors current pathFull Changelog: https://github.com/pdphilip/elasticlens/compare/v3.0.0...v3.0.1
This is an updated dependency release compatible with:
laravel-elasticsearch package v5Full Changelog: https://github.com/pdphilip/elasticlens/compare/v2.0.1...v3.0.0
Bug fix: lens:make command fixed to properly accommodate Domain spaced setups
Full Changelog: https://github.com/pdphilip/elasticlens/compare/v2.0.0...v2.0.1
Version 2 introduces breaking changes to support multiple model namespace mappings, providing flexibility for domain-driven architecture. This update allows the use of multiple model sources.
The elasticlens.php config file now requires the following structure:
'namespaces' => [
'App\Models' => 'App\Models\Indexes',
],
'index_paths' => [
'app/Models/Indexes/' => 'App\Models\Indexes',
],
• The namespaces key maps models to their respective index namespaces. • The index_paths key maps file paths to the corresponding index namespaces.
Full Changelog: https://github.com/pdphilip/elasticlens/compare/v1.3.1...v2.0.0
IndexableBuild model correctlygetBase(), asBase() & paginateBase()Full Changelog: https://github.com/pdphilip/elasticlens/compare/v1.3.0...v1.3.1
asModel() to asBase()paginateModels() to paginateBase()getBase() that can replace ....->get()->asBase()Dependency update to use laravel-elasticsearch ^v4.4
Full Changelog: https://github.com/pdphilip/elasticlens/compare/v1.2.2...v1.3.0
Dependency update to use laravel-elasticsearch v4.2
Full Changelog: https://github.com/pdphilip/elasticlens/compare/v1.1.0...v1.2.0
Bulk index (re)builder with:
php artisan lens:build {model}
The previous lens:build command is now lens:migrate, which better describes the feature.
php artisan lens:migrate {model}
See changelog for other minor updates:
Full Changelog: https://github.com/pdphilip/elasticlens/compare/v1.1.0...v1.1.0
ElasticLens is proud to announce its initial release. This powerful and flexible Laravel package is designed to allow developers to search their Laravel models with the convenience of Eloquent and the power of Elasticsearch.
You can install ElasticLens via Composer:
composer require pdphilip/elasticlens
Then run install:
php artisan lens:install
For detailed documentation and advanced usage, please refer to the GitHub repository.
Feedback, bug reports, and contributions are highly appreciated. Users and developers are encouraged to open issues or submit pull requests on the GitHub repository. The ElasticLens community looks forward to collaborating and improving the package together.
How can I help you explore Laravel packages today?