Download the PHP package aviationcode/elasticsearch without Composer
On this page you can find all versions of the php package aviationcode/elasticsearch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aviationcode/elasticsearch
More information about aviationcode/elasticsearch
Files in aviationcode/elasticsearch
Package elasticsearch
Short Description Laravel elasticsearch and eloquent integration
License MIT
Homepage https://github.com/aviationcode/elasticsearch
Informations about the package elasticsearch
Elasticsearch
This package wraps the elasticsearch/elasticsearch
composer package with laravel integration.
Adding support to easily use your eloquent models with elastic search.
Installation
Via Composer
Configuration
By default, we use localhost:9200
to search your elasticsearch instance. If this is the case no configuration is required at all.
You can use the following .env
settings to configure how we connect to your elasticsearch instance.
Name | Type | Default | Description |
---|---|---|---|
ELASTIC_HOST | string |
localhost |
The IP or host to connect to |
ELASTIC_PORT | integer |
9200 | The port used to connect |
ELASTIC_SCHEME | string |
http |
Use of HTTP or HTTPS |
ELASTIC_USER | string |
null |
The Basic auth username |
ELASTIC_PASSWORD | string |
null |
The Basic auth password |
Usage
Configure a model to use elasticsearch by using the ElasticSearchable
trait or extend using ElasticsearchModel
.
Custom mapping properties
We attempt to detect the elasticsearch mapping fields from your $dates
array and primary key. We are unable to correctly detect other fields.
Elasticsearch will in this case attempt to guess the mapping field automatically however it is recommended to explicitly define these fields as the correct type.
Use the elasticsearch documentation to find all options available.
Non numeric keys
When using UUID's or other non numeric keys make sure you configure your model correctly. This will make sure we use the correct mapping inside your model mapping.
Custom index name
You may want to use a custom name or use existing index name with your eloquent model. Just like you can define the database table used you can also define the index named used.
Note: You can still use $indexVersion
to add vX
at the end of your index.
Versioned index
If you like to version your index names you can use the $indexVersion
name. This will add _vX
at the end of your index name where X is the index version.
Query
Without an eloquent model.
Aggregations
Using aggregations with model.
Using aggregations without an eloquent model.
Console Commands
elastic:create-index
Creating elasticsearch index
Change log
Please see the changelog for more information on what has changed recently.
Testing
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover a security vulnerability within elasticsearch package, please send an e-mail to Ken Andries at [email protected]. All security vulnerabilities will be promptly addressed.
Credits
- Ken Andries
- All Contributors
License
license. Please see the license file for more information.
All versions of elasticsearch with dependencies
illuminate/support Version ^11.0
elasticsearch/elasticsearch Version ^6.0|^7.0