PHPackages                             mhd-neuroflash/laravel-elasticsearch-updated - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. mhd-neuroflash/laravel-elasticsearch-updated

AbandonedLibrary[API Development](/categories/api)

mhd-neuroflash/laravel-elasticsearch-updated
============================================

An easy way to use the official PHP ElasticSearch client in your Laravel applications.

15PHP

Since Nov 4Pushed 3y ago1 watchersCompare

[ Source](https://github.com/mhdEurFlash123/laravel-elasticsearch-updated)[ Packagist](https://packagist.org/packages/mhd-neuroflash/laravel-elasticsearch-updated)[ RSS](/packages/mhd-neuroflash-laravel-elasticsearch-updated/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (1)Used By (0)

Laravel-Elasticsearch
=====================

[](#laravel-elasticsearch)

An easy way to use the [official Elastic Search client](https://github.com/elastic/elasticsearch-php) in your Laravel or Lumen applications.

> ## ⚠️ This Package Will Be Abandoned
>
> [](#️-this-package-will-be-abandoned)
>
> Due to several factors, including the fact that I no longer use ES, I will be ceasing development on this package. If you are interested in taking over this project, please reach out to me here on the Issues board.

[![Build Status](https://github.com/cviebrock/laravel-elasticsearch/workflows/tests/badge.svg?branch=master)](https://github.com/cviebrock/laravel-elasticsearch/actions)[![Total Downloads](https://camo.githubusercontent.com/2e76d4c3054555a0182d926b54c95e5ce1833b9874c68ea3679f7930b66bce3d/68747470733a2f2f706f7365722e707567782e6f72672f6376696562726f636b2f6c61726176656c2d656c61737469637365617263682f646f776e6c6f6164732e706e67)](https://packagist.org/packages/cviebrock/laravel-elasticsearch)[![Latest Stable Version](https://camo.githubusercontent.com/83f7fca5d9cc68529e820edb749e0aa4903274b7cd2fa6d65039a77c4b57c278/68747470733a2f2f706f7365722e707567782e6f72672f6376696562726f636b2f6c61726176656c2d656c61737469637365617263682f762f737461626c652e706e67)](https://packagist.org/packages/cviebrock/laravel-elasticsearch)[![Latest Stable Version](https://camo.githubusercontent.com/0eebae1372d27d4154b0239cc4844f197dd08e68558523d4c07510de7020ff60/68747470733a2f2f706f7365722e707567782e6f72672f6376696562726f636b2f6c61726176656c2d656c61737469637365617263682f762f756e737461626c652e706e67)](https://packagist.org/packages/cviebrock/laravel-elasticsearch)[![License](https://camo.githubusercontent.com/7f9eb882dd44f0ebbf0b65238adda52920167763084e92074acef9da55c5c69a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6376696562726f636b2f6c61726176656c2d656c6173746963736561726368)](LICENSE.md)

- [Installation and Configuration](#installation-and-configuration)
    - [Laravel](#laravel)
        - [Alternative configuration method via .env file](#alternative-configuration-method-via-env-file)
        - [Connecting to AWS Elasticsearch Service](#connecting-to-aws-elasticsearch-service)
    - [Lumen](#lumen)
- [Usage](#usage)
- [Advanced Usage](#advanced-usage)
- [Console Commands](#console-commands)
- [Bugs, Suggestions, Contributions and Support](#bugs-suggestions-contributions-and-support)
- [Copyright and License](#copyright-and-license)

Installation and Configuration
------------------------------

[](#installation-and-configuration)

Install the current version of the `cviebrock/laravel-elasticsearch` package via composer:

```
composer require cviebrock/laravel-elasticsearch
```

If you are using ElasticSearch version 5, then install version 2 of this package:

```
composer require cviebrock/laravel-elasticsearch:^2
```

### Laravel

[](#laravel)

The package's service provider will automatically register its service provider.

Publish the configuration file:

```
php artisan vendor:publish --provider="Cviebrock\LaravelElasticsearch\ServiceProvider"
```

##### Alternative configuration method via .env file

[](#alternative-configuration-method-via-env-file)

After you publish the configuration file as suggested above, you may configure ElasticSearch by adding the following to your application's `.env` file (with appropriate values):

```
ELASTICSEARCH_HOST=localhost
ELASTICSEARCH_PORT=9200
ELASTICSEARCH_SCHEME=http
ELASTICSEARCH_USER=
ELASTICSEARCH_PASS=
```

##### Connecting to AWS Elasticsearch Service

[](#connecting-to-aws-elasticsearch-service)

If you are connecting to ElasticSearch instances on Amazon AWS, then you'll also need to `composer require aws/aws-sdk-php:^3.80` and add the following to your `.env` file:

```
AWS_ELASTICSEARCH_ENABLED=true
AWS_REGION=...
AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...
```

If you have to use another authentication method having custom credentials (i.e. `instanceProfile()`), you have to publish the configuration file and use the **aws\_credentials**:

```
