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

ActiveStatamic-addon[Search &amp; Filtering](/categories/search)

thehome/statamic-elasticsearch
==============================

Elasticsearch driver for Statamic

1.4.2(2y ago)43.4k↓33.3%3[3 issues](https://github.com/thehomedk/statamic-elasticsearch/issues)proprietaryPHPPHP ^8.0

Since Jan 5Pushed 2y agoCompare

[ Source](https://github.com/thehomedk/statamic-elasticsearch)[ Packagist](https://packagist.org/packages/thehome/statamic-elasticsearch)[ Docs](https://www.thehome.dk)[ RSS](/packages/thehome-statamic-elasticsearch/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (14)Used By (0)

[![Statamic 3.0+](https://camo.githubusercontent.com/a6038d676eaff77f15810a50151917725b1d591a549679ec76f4887551dc9048/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53746174616d69632d332e302b2d4646323639453f7374796c653d666f722d7468652d6261646765)](https://statamic.com)[![Latest Version on Packagist](https://camo.githubusercontent.com/35f676c1751466e719430c6c5c90d27128328c46f1aaeff88b6fb4b9c3139272/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746865686f6d652f73746174616d69632d656c61737469637365617263682e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/thehome/statamic-elasticsearch)[![](logo-elastic-horizontal-color.png?raw=true)](logo-elastic-horizontal-color.png?raw=true)

Elasticsearch driver for Statamic
=================================

[](#elasticsearch-driver-for-statamic)

This addon add's a Elasticsearch driver to Statamics builtin search system ( [docs](https://statamic.dev/search) ).

Setup index
-----------

[](#setup-index)

Indexes are configured in `config/statamic/search.php` and uses the standard Statamic index configuration. There's a few extra nice configuration options.

Here's an entry in `indexes` for the pages collection:

```
'public' => [
  'driver' => 'elasticsearch',
  'searchables' => 'collection:pages',
  'fields' => ['title', 'description', 'content'],
],

```

Here's an example entry in the `drivers` section defining the connection properties for your Elasticsearch server.

```
'elasticsearch' => [
    'hosts' => [[
       'scheme' => env('ELASTICSEARCH_SCHEME', 'http'),
       'host' => env('ELASTICSEARCH_HOST', '127.0.0.1'),
       'port' => env('ELASTICSEARCH_PORT', 9200),
    ]]
],

```

Content transformation
----------------------

[](#content-transformation)

Statamic supports transformers for the index data, but the current implementation is not compatible with how Laravel serializes the configuration when running `php artisan optimize`. Therefore this driver has it's own system that can be configured like this:

```
'public' => [
  ...
  'transforms' => ['content' => 'bardToText'],
],

```

#### Available transformers

[](#available-transformers)

- 'bardToText`, converts the ProseMirror data structure into plain text so it can be indexed.
- 'handle', converts fields that has a handle (eg. site and collection) into the handle text.

Analyzers
---------

[](#analyzers)

Elasticsearch supports different text analyzers for indexing. The analyzer determines how tokenization, stop-words and stemming is handled. You can set the default analyzer used (for all fields) like this:

```
'public' => [
  'driver' => 'elasticsearch',
  'searchables' => 'collection:pages',
  'fields' => ['title', 'description', 'content'],
  'analyzer' => 'danish'
],

```

If not set, the `standard` analyzer is used. See list of available language analyzers [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-lang-analyzer.html).

Field boost
-----------

[](#field-boost)

You can boost individual fields by defining a boost value.

```
'boost' => [
    'title' => '2',
    'keywords' => '2'
]

```

Updating indexes
----------------

[](#updating-indexes)

Whenever you save an item in the Control Panel it will automatically update any appropriate indexes as this is extending the Statamic search. As expected you can update the index via command line.

```
php please search:update public

```

Verify indexed data
-------------------

[](#verify-indexed-data)

You can verify that your elaticsearch index looks correct with:

```
curl 127.0.0.1:9200/_cat/indices/public?v

```

Or make queries directly with:

```
curl 127.0.0.1:9200/public/_search?q=test | jq

```

Templating
----------

[](#templating)

You can use the default Statamic search tag like usual:

```
{{ search:results index="public"}}
    {{ if no_results }}
        No results.
    {{ else }}

            {{ title }}
            {{ description | truncate:180 }}

    {{ /if }}
{{ /search:results }}

```

### Livewire componenent with pagination

[](#livewire-componenent-with-pagination)

The included Livewire component supports pagination using Elasticsearch for the pagination. This requires that the fields `status` are indexed so add them to the config:

```
'public' => [
  ....
  'fields' => [ ... 'status'],
],

```

If you have multiple sites and wan't the search page to only return results from a specific site then you must add the `site` field to the index. The `site` field is an object so it must be transformed with the `handle` transformer.

```
'public' => [
  ....
  'fields' => [ ... 'status', 'site'],
  'transforms' => ['site' => 'handle'],
],

```

Then you need to have Livewire support for your antlers templates. The easy way is to install Jonas's addon :

```
composer require jonassiewertsen/statamic-livewire

```

Then make your search antlers template including:

```
{{ livewire:styles }}
{{ livewire:elasticsearch.search index="public" size="10"}}
{{ livewire:scripts }}

```

The template can be overridden by publishing it:

```
php artisan vendor:publish --tag=elasticsearch-views

```

### Planned features

[](#planned-features)

- Set analyzer based om documents site locale
- Configurable multi-match query type

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance5

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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

Every ~85 days

Recently: every ~53 days

Total

12

Last Release

1019d ago

PHP version history (3 changes)1.0.0PHP ^7.4

1.1.0PHP ^7.4 || ^8.0

1.4PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/d192b88c450299ba318009607e2748a07d56ba84b483fac2f273d6b91f0bd26a?d=identicon)[thelmer](/maintainers/thelmer)

---

Top Contributors

[![tomhelmer](https://avatars.githubusercontent.com/u/1961641?v=4)](https://github.com/tomhelmer "tomhelmer (75 commits)")

---

Tags

elasticsearchstatamic-searchelasticsearchstatamic

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/thehome-statamic-elasticsearch/health.svg)

```
[![Health](https://phpackages.com/badges/thehome-statamic-elasticsearch/health.svg)](https://phpackages.com/packages/thehome-statamic-elasticsearch)
```

###  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)[statamic-rad-pack/meilisearch

meilisearch search driver for Statamic

1661.7k](/packages/statamic-rad-pack-meilisearch)[marcorieser/statamic-live-search

A Statamic Live Search realized with Laravel Livewire.

2210.5k](/packages/marcorieser-statamic-live-search)

PHPackages © 2026

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