PHPackages                             3xw/cakephp-elastic-search - 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. 3xw/cakephp-elastic-search

ActiveCakephp-plugin[Search &amp; Filtering](/categories/search)

3xw/cakephp-elastic-search
==========================

CakePHP pages plugins

5.0.2(3mo ago)1310PHPPHP &gt;=8.0

Since Mar 2Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/3xw/cakephp-elastic-search)[ Packagist](https://packagist.org/packages/3xw/cakephp-elastic-search)[ RSS](/packages/3xw-cakephp-elastic-search/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (3)Versions (38)Used By (0)

cakephp-elastic-search plugin for CakePHP
=========================================

[](#cakephp-elastic-search-plugin-for-cakephp)

This plugin allows you deal with ES

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

[](#installation)

You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).

The recommended way to install composer packages is:

```
composer require 3xw/elastic-search

```

Load it in your config/boostrap.php

```
Plugin::load('Trois/ElasticSearch');

```

Setup
-----

[](#setup)

in app.php add at least one connection:

```
'Datasources' => [
    'elastic' => [
      'className' => 'Cake\ElasticSearch\Datasource\Connection',
      'driver' => 'Cake\ElasticSearch\Datasource\Connection',
      'host' => 'localhost',
      'port' => 6379,
    ],
	...
]

```

Mapping
-------

[](#mapping)

The shell will ask you a mapping template. Follow offical doc [native elasticsearch mapping format](https://www.elastic.co/guide/en/elasticsearch/reference/6.x/mapping.html) to create your own index mapping or use default one which the prompt proposes you: vendor/3xw/cakephp-elastic-search/templates/mapping.json

```
{
	"settings": {
    "analysis": {
      "filter": {
        "french_elision": {
          "type":"elision",
          "articles_case": true,
          "articles": [
            "l", "m", "t", "qu", "n", "s",
            "j", "d", "c", "jusqu", "quoiqu",
            "lorsqu", "puisqu","t"
          ]
        },
        "french_stop": {
          "type":       "stop",
          "stopwords":  "_french_"
        },
        "french_keywords": {
          "type":       "keyword_marker",
          "keywords":   [
            "Prométerre",
            "Agrivit","Ecoprest","Estimapro","Fidasol","Fiprom",
            "Fondation rurale de prévoyance","FRP",
            "Mandaterre",
            "Office de crédit agricole","OCA",
            "Proconseil","Proterroir","SAD","SRPJ","Sofia SA"
          ]
        },
        "french_stemmer": {
          "type":       "stemmer",
          "language":   "light_french"
        }
      },
      "analyzer": {
        "french": {
          "tokenizer":  "standard",
          "filter": [
            "french_elision",
            "lowercase",
            "french_stop",
            "french_keywords",
            "french_stemmer"
          ]
        }
      }
    }
  },
  "mappings": {
    "items": {
      "properties": {
        "foreign_key": { "type": "integer"},
        "model": { "type": "keyword"},
        "title": {"type": "completion", "analyzer":"french", "max_input_length": 255},
        "content": {"type": "text"}
      }
    }
  }
}

```

Behavior
--------

[](#behavior)

set up your behavior as you wish

```
$this->addBehavior(\Trois\ElasticSearch\ORM\Behavior\SyncWithESBehavior::class,[
  'index' => 'App\Model\Index\ItemsIndex',
  'primaryKey' => 'foreign_key', // string or callable
  'translate' => false, // property name if yes ex: locale
  'staticMatching' => [
    'model' => 'Posts'
  ], // or [keyN => valueN/callableN]
  'mapping' => [ // properties => 1. Array: entity field(s) || properties => 2. String: static value or callable
    'title' => new \Trois\ElasticSearch\ORM\CompletionConstructor(['title'],[
      'contexts' => [
        'model' => 'Posts'
      ],
     ]),
    'content' => ['header','content']
  ],
  'deleteDocument' => true,
  'separator' => ' - '
]);

```

Shell
-----

[](#shell)

Create indexes

```
bin/cake elastic create [indexName] [mappingFile.json]

------
Execute create index w/ mapping file Task.

Usage:
cake trois/elastic_search.elastic create [-c] [-h] [-q] [-r 1] [-s 5] [-v]

Options:

--connection, -c  The Elestic Search connection to use
--help, -h        Display this help.
--quiet, -q       Enable quiet output.
--replicas, -r    The index number of replicas. Default is 1
                  (default: 1)
--shards, -s      The index number of shards. Default is 5
                  (default: 5)
--verbose, -v     Enable verbose output.

```

Get index info

```
bin/cake elastic info [indexName]

------
Execute info on index Task.

Usage:
cake trois/elastic_search.elastic info [-c] [-h] [-q] [-v]

Options:

--connection, -c  The Elestic Search connection to use
--help, -h        Display this help.
--quiet, -q       Enable quiet output.
--verbose, -v     Enable verbose output.

```

Delete index

```
bin/cake elastic delete [indexName]

------
Execute delete index Task.

Usage:
cake trois/elastic_search.elastic delete [-c] [-h] [-q] [-v]

Options:

--connection, -c  The Elestic Search connection to use
--help, -h        Display this help.
--quiet, -q       Enable quiet output.
--verbose, -v     Enable verbose output.

```

Import entire table

```
bin/cake elastic import [indexName] [tableName]
------
Execute import on index with table.

Usage:
cake trois/elastic_search.elastic import [-c] [-h] [-q] [-v]

Options:

--connection, -c  The Elestic Search connection to use
--help, -h        Display this help.
--quiet, -q       Enable quiet output.
--verbose, -v     Enable verbose output.

```

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance78

Regular maintenance activity

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 85.9% 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 ~80 days

Recently: every ~398 days

Total

37

Last Release

117d ago

Major Versions

3.x-dev → 4.0.02021-09-03

4.1.0 → 5.02026-01-09

PHP version history (3 changes)3.5.0.0PHP &gt;=5.5.9

3.7.0.11PHP &gt;=7.2

4.1.0PHP &gt;=8.0

### Community

Maintainers

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

---

Top Contributors

[![awallef](https://avatars.githubusercontent.com/u/1070992?v=4)](https://github.com/awallef "awallef (85 commits)")[![jeanvier](https://avatars.githubusercontent.com/u/1822085?v=4)](https://github.com/jeanvier "jeanvier (14 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/3xw-cakephp-elastic-search/health.svg)

```
[![Health](https://phpackages.com/badges/3xw-cakephp-elastic-search/health.svg)](https://phpackages.com/packages/3xw-cakephp-elastic-search)
```

###  Alternatives

[ruflin/elastica

Elasticsearch Client

2.3k50.4M203](/packages/ruflin-elastica)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15024.3M65](/packages/opensearch-project-opensearch-php)[friendsofcake/search

CakePHP Search plugin using PRG pattern

1742.0M37](/packages/friendsofcake-search)[massive/search-bundle

Massive Search Bundle

721.4M13](/packages/massive-search-bundle)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45802.7k3](/packages/outl1ne-nova-multiselect-filter)[handcraftedinthealps/zendsearch

a general purpose text search engine written entirely in PHP 5

39921.0k35](/packages/handcraftedinthealps-zendsearch)

PHPackages © 2026

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