Getting Started
This content is for v3.9. Switch to the latest version for up-to-date documentation.
An Elasticsearch implementation of Laravel’s Eloquent ORM
This package extends Laravel’s Eloquent model and query builder with seamless integration of Elasticsearch functionalities. Designed to feel native to Laravel, this package enables you to work with Eloquent models while leveraging the powerful search and analytics capabilities of Elasticsearch.
Looking to use the OpenSearch version of this package? Github
Installation - 3.x
Laravel 9
- Elasticsearch 8.x
Laravel 8
- Elasticsearch 8.x
Configuration
- Set up your
.env
with the following Elasticsearch settings: For multiple nodes, pass in as comma-separated:Example cloud config .env: (Click to expand)
- In
config/database.php
, add the elasticsearch connection: - If packages are not autoloaded, add the service provider:
Now, you’re all set to use Elasticsearch with Laravel as if it were native to the framework.
Package versions
Elasticsearch 8.x
Laravel Version | Command | Maintenance |
---|---|---|
Laravel 10 & 11 | composer require pdphilip/elasticsearch | ✅ Active |
Laravel 9 | composer require pdphilip/elasticsearch:~3.9 | 🛠️ LTS |
Laravel 8 | composer require pdphilip/elasticsearch:~3.8 | 🛠️ LTS |
Laravel 7.x | composer require pdphilip/elasticsearch:~2.7 | ❌ EOL |
Laravel 6.x (5.8) | composer require pdphilip/elasticsearch:~2.6 | ❌ EOL |
Elasticsearch 7.x
Laravel Version | Command | Maintenance |
---|---|---|
Laravel 9.x | composer require pdphilip/elasticsearch:~1.9 | ❌ EOL |
Laravel 8.x | composer require pdphilip/elasticsearch:~1.8 | ❌ EOL |
Laravel 7.x | composer require pdphilip/elasticsearch:~1.7 | ❌ EOL |
Laravel 6.x (5.8) | composer require pdphilip/elasticsearch:~1.6 | ❌ EOL |