Download the PHP package abrbit/laravel-scout-elasticsearch without Composer
On this page you can find all versions of the php package abrbit/laravel-scout-elasticsearch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download abrbit/laravel-scout-elasticsearch
More information about abrbit/laravel-scout-elasticsearch
Files in abrbit/laravel-scout-elasticsearch
Package laravel-scout-elasticsearch
Short Description A Laravel Scout driver for Elasticsearch with developer-friendly syntax.
License MIT
Informations about the package laravel-scout-elasticsearch
π§ Abrbit Laravel Scout Elasticsearch Driver
A developer-friendly Laravel Scout driver for Elasticsearch β built for distributed, scalable, and clean search experiences.
Crafted with β€οΈ by the Abrbit team.
π Features
β
Plug-and-play with Laravel Scout
β
Uses official Elasticsearch REST API
β
Auto-maps documents & IDs for distributed clusters
β
Supports multi-field search (e.g., title + description)
β
Fully configurable via config/services.php
β
Developer-friendly syntax β clean and minimal
π¦ Installation
Then register your search service endpoint and credentials in .env:
βοΈ Configuration
In your config/scout.php, set the driver to abrbit:
And in config/services.php, add:
π§© Usage
You can use Laravel Scoutβs native methods directly:
1. Get Eloquent Models (get())
This is the standard Scout method. It returns an Eloquent Collection of your models, hydrated from the database based on the IDs returned from the search.
2. Get Raw Source Data (getSource())
This is the recommended method for APIs or when you don't need full Eloquent models. It returns a clean array containing only the _source data directly from Elasticsearch, avoiding any database queries and providing excellent performance.
3. Get Paginated Raw Source Data (searchSource())
This method is similar to getSource(), but it supports pagination and is optimized for partial and short-term searches (e.g., 2 characters). It returns a paginated array of source data.
4. Get the Raw Elasticsearch Response (raw())
This method returns the entire, unprocessed JSON response from Elasticsearch. It is useful for debugging or when you need access to metadata like took, _shards, or max_score.
Your Eloquent model only needs to implement the Searchable trait:
π Example Query
Hereβs what an example query looks like under the hood:
π§ How It Works
AbrbitSearchEngine is a custom Laravel Scout engine that:
- Sends search requests to your Elasticsearch instance.
- Handles
_idassignment automatically by Elasticsearch. - Supports distributed, multi-tenant indexes like
tenant_songsoruser_posts. - Maps
_sourcedata back into Eloquent models seamlessly.
Example search response:
π§° Developer Notes
- Designed for SaaS and multi-tenant applications.
- Compatible with any REST-compatible Elasticsearch cluster (v8+ recommended).
- Works perfectly with Laravel Scoutβs indexing pipeline.
π§βπ» Contributing
We welcome contributions!
Feel free to open issues or submit pull requests.
βοΈ License
Released under the MIT License.
π About Abrbit
Abrbit provides modern cloud infrastructure and SaaS services β
from DNS & mail hosting to AI, storage, and classroom platforms.
π‘ Visit us at abrbit.com