PHPackages                             codedefective/elasticsearch - 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. [Database &amp; ORM](/categories/database)
4. /
5. codedefective/elasticsearch

ActiveLibrary[Database &amp; ORM](/categories/database)

codedefective/elasticsearch
===========================

An Elasticsearch implementation of Laravel's Eloquent ORM

v5.3.0(1mo ago)00MITPHPPHP ^8.2CI failing

Since Mar 29Pushed 1mo agoCompare

[ Source](https://github.com/codedefective/laravel-elasticsearch)[ Packagist](https://packagist.org/packages/codedefective/elasticsearch)[ Docs](https://github.com/codedefective/laravel-elasticsearch)[ RSS](/packages/codedefective-elasticsearch/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (18)Versions (4)Used By (0)

[![Laravel Elasticsearch](https://camo.githubusercontent.com/0eef5e70dc2f3c3697d09e83a35709f43de40f5dcbe4d41b53ee5b9fa886b44e/68747470733a2f2f63646e2e736e6970666f726d2e696f2f636f64656465666563746976652f656c61737469637365617263682f6c61726176656c2d65732d62616e6e65722e706e67)](https://camo.githubusercontent.com/0eef5e70dc2f3c3697d09e83a35709f43de40f5dcbe4d41b53ee5b9fa886b44e/68747470733a2f2f63646e2e736e6970666f726d2e696f2f636f64656465666563746976652f656c61737469637365617263682f6c61726176656c2d65732d62616e6e65722e706e67)

[![Latest Stable Version](https://camo.githubusercontent.com/889283d26497ecc527664f8ca7df037da951cd99e5b277e29aedd2c5024cddc1/687474703a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f636f64656465666563746976652f6c61726176656c2d656c61737469637365617263682e737667)](https://packagist.org/packages/codedefective/elasticsearch)[![GitHub Tests Action Status](https://camo.githubusercontent.com/053c5184bd06f0238f50207f4b5536babb1e80c6a294b24d0c8961ac9143a84d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636f64656465666563746976652f6c61726176656c2d656c61737469637365617263682f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/codedefective/laravel-elasticsearch/actions/workflows/run-tests.yml?query=branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/62cd133b073130098739c98d4490eb121ba238844aac24349da02d220803f803/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636f64656465666563746976652f6c61726176656c2d656c61737469637365617263682f7068707374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/codedefective/laravel-elasticsearch/actions/workflows/phpstan.yml?query=branch%3Amain++)[![Total Downloads](https://camo.githubusercontent.com/45c2b77c598cfac1fabc1f5f0460151723774c76200f64840e81f23d40d7ef73/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f636f64656465666563746976652f656c61737469637365617263682e737667)](https://packagist.org/packages/codedefective/elasticsearch)

---

This library is a clone of [pdphilip/laravel-elasticsearch](https://github.com/pdphilip/laravel-elasticsearch/)
===============================================================================================================

[](#this-library-is-a-clone-of-pdphiliplaravel-elasticsearch)

---

Laravel-Elasticsearch
 An Elasticsearch implementation of Laravel's Eloquent ORM
---------------------------------------------------------------------------------

[](#laravel-elasticsearch--an-elasticsearch-implementation-of-laravels-eloquent-orm)

### The Power of Elasticsearch with Laravel's Eloquent

[](#the-power-of-elasticsearch-with-laravels-eloquent)

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.

---

The Eloquent you already know:

```
UserLog::where('created_at','>=',Carbon::now()->subDays(30))->get();
```

```
UserLog::create([
    'user_id' => '2936adb0-b10d-11ed-8e03-0b234bda3e12',
    'ip' => '62.182.98.146',
    'location' => [40.7185,-74.0025],
    'country_code' => 'US',
    'status' => 1,
]);
```

```
UserLog::where('status', 1)->update(['status' => 4]);
```

```
UserLog::where('status', 4)->orderByDesc('created_at')->paginate(50);
```

```
UserProfile::whereIn('country_code',['US','CA'])
    ->orderByDesc('last_login')->take(10)->get();
```

```
UserProfile::where('state','unsubscribed')
    ->where('updated_at','
