PHPackages                             triadev/laravel-elasticsearch-mapping - 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. [Search &amp; Filtering](/categories/search)
4. /
5. triadev/laravel-elasticsearch-mapping

ActiveLibrary[Search &amp; Filtering](/categories/search)

triadev/laravel-elasticsearch-mapping
=====================================

A service provider for laravel with a fluent elasticsearch mapping builder.

v1.0.0(7y ago)2421MITPHPPHP &gt;=7.1

Since Jan 12Pushed 7y ago1 watchersCompare

[ Source](https://github.com/triadev/laravel-elasticsearch-mapping)[ Packagist](https://packagist.org/packages/triadev/laravel-elasticsearch-mapping)[ RSS](/packages/triadev-laravel-elasticsearch-mapping/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (8)Versions (2)Used By (1)

laravel-elasticsearch-mapping
=============================

[](#laravel-elasticsearch-mapping)

A service provider for laravel with a fluent elasticsearch mapping builder.

[![Software license](https://camo.githubusercontent.com/3045452b95a5f248394bce2d2e3c7ea4c147906d124e8c9f40e906133d9059d9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f747269616465762f6c61726176656c2d656c61737469637365617263682d6d617070696e672e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Travis](https://camo.githubusercontent.com/9064085897b5c57191011634ed3dad830f6ea924028781a1ac55cfef82a77eaf/68747470733a2f2f7472617669732d63692e6f72672f747269616465762f6c61726176656c2d656c61737469637365617263682d6d617070696e672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/triadev/laravel-elasticsearch-mapping)[![Coveralls](https://camo.githubusercontent.com/a6ee8a9351855782511c793f13b8b9ab1f48215794084c1a7a2dc7c511c372c5/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f747269616465762f6c61726176656c2d656c61737469637365617263682d6d617070696e672f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/triadev/laravel-elasticsearch-mapping?branch=master)[![CodeCov](https://camo.githubusercontent.com/26fd0dc74008fdd3f054077d27d5ff7eafbcdb8624250e946e1aa0514675cfb0/68747470733a2f2f636f6465636f762e696f2f67682f747269616465762f6c61726176656c2d656c61737469637365617263682d6d617070696e672f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/triadev/laravel-elasticsearch-mapping)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/11010fa50d60cd9585787cdaf3440228662b75006380b4ddf0a0ad8150199abe/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f747269616465762f6c61726176656c2d656c61737469637365617263682d6d617070696e672f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/triadev/laravel-elasticsearch-mapping/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/c2487920bd3f2fab2f32e01f0c688c0b01d02f94b1d610e9ef35841c1bdce9cf/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f747269616465762f6c61726176656c2d656c61737469637365617263682d6d617070696e672f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/triadev/laravel-elasticsearch-mapping/?branch=master)[![Build Status](https://camo.githubusercontent.com/a68520feb8600a317468b0db1dec949015e60445402564037809e3b109f31cf5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f747269616465762f6c61726176656c2d656c61737469637365617263682d6d617070696e672f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/triadev/laravel-elasticsearch-mapping/build-status/master)

[![Latest stable](https://camo.githubusercontent.com/cc68428a3b5c79a39afaa841d45d6a2cab6b0b2045021499537761ff5d1f8437/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f747269616465762f6c61726176656c2d656c61737469637365617263682d6d617070696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/triadev/laravel-elasticsearch-mapping)[![Latest development](https://camo.githubusercontent.com/efca3a923922cf6679ac1920d726f43aa9ce02ddf45d273ecb65c8f42cb8c597/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f747269616465762f6c61726176656c2d656c61737469637365617263682d6d617070696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/triadev/laravel-elasticsearch-mapping)[![Monthly installs](https://camo.githubusercontent.com/ce0cb5e0032498bb97ae950711d1b639255459f788fa4c43df0d3831b0b680f4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f747269616465762f6c61726176656c2d656c61737469637365617263682d6d617070696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/triadev/laravel-elasticsearch-mapping/stats)[![Total Downloads](https://camo.githubusercontent.com/7bca82dcec3645f111cbbe6bbf7f6309c6b9c54129b6b0b88a222728c672278a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f747269616465762f6c61726176656c2d656c61737469637365617263682d6d617070696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/triadev/laravel-elasticsearch-mapping)

Supported laravel versions
--------------------------

[](#supported-laravel-versions)

[![Laravel 5.5](https://camo.githubusercontent.com/1bd291589054cd0fea96c97b26e57f7dfd024f3d20572a13a74a64e37aa053d6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e352d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)[![Laravel 5.6](https://camo.githubusercontent.com/19208e4e17c5a44f6eeb2ca49987cf944b671fbd1069f1e5cc006c509f119e2b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e362d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)[![Laravel 5.7](https://camo.githubusercontent.com/01e109b20d194f8c9f7398bde86682d9457d92fbf7485b4ffabf6746df741d64/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e372d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)

Supported elasticsearch versions
--------------------------------

[](#supported-elasticsearch-versions)

[![Elasticsearch 6.0](https://camo.githubusercontent.com/810d03fd98470d0400d68f20b1fe4dc219e4a8a887c96ce5ce3b545e71475380/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f456c61737469637365617263682d362e302d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://www.elastic.co/)[![Elasticsearch 6.1](https://camo.githubusercontent.com/bc2e01ea13c32ac5cb11c1a7dce2abf6d98891c8f4697973715b6f9a5447192c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f456c61737469637365617263682d362e312d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://www.elastic.co/)[![Elasticsearch 6.2](https://camo.githubusercontent.com/6f0ef3d891eaf0eeb74cb60fdc5c7a74bfe5879aa428ecc5758dea885fc2f920/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f456c61737469637365617263682d362e322d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://www.elastic.co/)[![Elasticsearch 6.3](https://camo.githubusercontent.com/93ac37d9096d3c081e5a46d1a0aea549f2fe8b8a09bab0fefe2c85a753e55fac/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f456c61737469637365617263682d362e332d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://www.elastic.co/)[![Elasticsearch 6.4](https://camo.githubusercontent.com/922fceaef72c0a5ab286fd0b454b5c477b97c51b0e13037edd5f763971c9e711/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f456c61737469637365617263682d362e342d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://www.elastic.co/)

Installation
------------

[](#installation)

### Composer

[](#composer)

> composer require triadev/laravel-elasticsearch-mapping

### Application

[](#application)

The package is registered through the package discovery of laravel and Composer.

>

Configuration
-------------

[](#configuration)

The elasticsearch client is generated via the package: [LaravelElasticsearchProvider](https://github.com/triadev/LaravelElasticsearchProvider).
You can find the environment variables for the elasticsearch client in the readme of the package.

Usage
-----

[](#usage)

This package offers a fluent mapping builder for elasticsearch. The entry point for each mapping build is a facade.

> Triadev\\Es\\Mapping\\Facade\\ElasticMapping

### Build mapping

[](#build-mapping)

```
use Triadev\Es\Mapping\Facade\ElasticMapping;
use Triadev\Es\Mapping\Mapping\Blueprint;

ElasticMapping::map(function (Blueprint $blueprint) {
    // fluent syntax
    $blueprint->keyword('EXAMPLE')->boost(5);

    // attributes array syntax
    $blueprint->keyword('EXAMPLE', [
        'boost' => 5
    ]);

    // settings are used when creating a new index
    $blueprint->settings([
        'index' => [
            'number_of_replicas' => 10,
            'number_of_shards' => 12,
            'refresh_interval' => '30s'
        ]
    ]);
}, INDEX, TYPE);
```

#### Create index

[](#create-index)

If the index does not exist a new index will be created. This also includes the configuration from *$blueprint-&gt;settings()*.

#### Update index

[](#update-index)

If the index exists an update will be executed.

Reporting Issues
----------------

[](#reporting-issues)

If you do find an issue, please feel free to report it with GitHub's bug tracker for this project.

Alternatively, fork the project and make a pull request. :)

Testing
-------

[](#testing)

1. docker-compose -f docker-compose.yml up
2. composer test

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Christopher Lorke](https://github.com/triadev)
- [All Contributors](../../contributors)

Other
-----

[](#other)

### Project related links

[](#project-related-links)

- [Wiki](https://github.com/triadev/laravel-elasticsearch-mapping/wiki)
- [Issue tracker](https://github.com/triadev/laravel-elasticsearch-mapping/issues)

### License

[](#license)

The code for laravel-elasticsearch-mapping is distributed under the terms of the MIT license (see [LICENSE](LICENSE)).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2678d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/806ca8236e565a4a76aaad0ad4382dc52f1bc4b7850712878e1fb89826cd2bb8?d=identicon)[triadev](/maintainers/triadev)

---

Top Contributors

[![triadev](https://avatars.githubusercontent.com/u/10552858?v=4)](https://github.com/triadev "triadev (2 commits)")

---

Tags

elasticsearchlaravelmappinglaravelelasticsearchmapping

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/triadev-laravel-elasticsearch-mapping/health.svg)

```
[![Health](https://phpackages.com/badges/triadev-laravel-elasticsearch-mapping/health.svg)](https://phpackages.com/packages/triadev-laravel-elasticsearch-mapping)
```

###  Alternatives

[mailerlite/laravel-elasticsearch

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

934529.3k2](/packages/mailerlite-laravel-elasticsearch)[jeroen-g/explorer

Next-gen Elasticsearch driver for Laravel Scout.

397612.3k](/packages/jeroen-g-explorer)[baijunyao/laravel-scout-elasticsearch

Elasticsearch Driver for Laravel Scout

8023.7k1](/packages/baijunyao-laravel-scout-elasticsearch)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
