PHPackages                             divante-ltd/pimcore-elasticsearch-plugin - 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. divante-ltd/pimcore-elasticsearch-plugin

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

divante-ltd/pimcore-elasticsearch-plugin
========================================

Flexible ElasticSearch Plugin for Pimcore - now with DSL!

1.0.5(8y ago)98041[1 issues](https://github.com/DivanteLtd/pimcore-elasticsearch-plugin/issues)GPL-3.0+PHPPHP &gt;=7

Since Jun 13Pushed 8y ago22 watchersCompare

[ Source](https://github.com/DivanteLtd/pimcore-elasticsearch-plugin)[ Packagist](https://packagist.org/packages/divante-ltd/pimcore-elasticsearch-plugin)[ RSS](/packages/divante-ltd-pimcore-elasticsearch-plugin/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (10)Used By (0)

PimcoreElasticsearchPlugin
==========================

[](#pimcoreelasticsearchplugin)

Requirements
------------

[](#requirements)

- PHP 7 or newer
- Pimcore 4
- Elasticsearch 5
- Composer

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

[](#installation)

### First step

[](#first-step)

#### via Composer

[](#via-composer)

```
composer require divante-ltd/pimcore-elasticsearch-plugin

```

#### manually

[](#manually)

- Download this repository into your plugins directory.
- Download manually dependencies (see composer.json).
- Follow next steps in this instruction.

### Second step

[](#second-step)

Open Extension tab in admin panel and install plugin. After this, installation is finished.

Usage
-----

[](#usage)

### How to use config service?

[](#how-to-use-config-service)

```
$container = \Pimcore::getDiContainer();
/** @var \DivanteLtd\PimcoreElasticsearchPlugin\Service\ConfigService $configService */
$configService = $container->get('DivanteLtd\PimcoreElasticsearchPlugin\Service\ConfigService');

$configService->setHosts(["127.0.0.1:9200"]);

$indices = [
    "exampleIndex" => [
        "mappings" => [
            "newsType" => [
                "properties" => [
                    "title" => [
                        "type" => "string",
                        "analyzer" => "standard"
                    ]
                ]
            ]
        ],
        //...
    ]
];
foreach ($indices as $indexName => $body) {
    $configService->addIndex($indexName, $body);
}

```

INFO: remember config service must be configured before you call elasticsearch service, e.g.: in plugin init method.

### Creating index

[](#creating-index)

```
php pimcore/cli/console.php divante-ltd:elasticsearch:create-index exampleIndex

```

It will create index in elasticsearch.

INFO: it allows only to create indices which where added to config service.

### Removing index

[](#removing-index)

```
php pimcore/cli/console.php divante-ltd:elasticsearch:remove-index exampleIndex

```

It will remove index from elasticsearch.

### Indexers

[](#indexers)

```

use DivanteLtd\PimcoreElasticsearchPlugin\Indexer\AbstractIndexer;

class ExampleIndexer extends AbstractIndexer
{

    /**
     * @param AbstractElement $element
     *
     * @return bool
     */
    public function isIndexable(AbstractElement $element): bool
    {
        return $element instanceof News;
    }

    /**
     * @param AbstractElement|News $element
     *
     * @return array
     */
    public function buildDocument(AbstractElement $element): array
    {
        return [
            'title' => $element->getTitle(),
        ];
    }

    /**
     * @return string
     */
    public function getIndexName(): string
    {
        return 'exampleIndex';
    }

    /**
     * @return string
     */
    public function getType(): string
    {
        return 'newsType';
    }
}

```

You need also to register this indexer, so it can work with reindex all command and event listeners like object.postAdd, etc.

```
/** @var \DivanteLtd\PimcoreElasticsearchPlugin\Indexer\Service\IndexerRegisterService $indexerRegister */
$indexerRegister = \Pimcore::getDiContainer()->get(
    'DivanteLtd\PimcoreElasticsearchPlugin\Indexer\Service\IndexerRegisterService'
);
$indexerRegister->add(new ExampleIndexer());

```

From now everytime you add, edit or delete object which is instance of News class, it will be added, saved or deleted from elastic.

### How to reindex everything?

[](#how-to-reindex-everything)

```
php pimcore/cli/console.php divante-ltd:elasticsearch:reindex-all

```

If you want to reindex only e.g. objects:

```
php pimcore/cli/console.php divante-ltd:elasticsearch:reindex-all --objects

```

### How to search?

[](#how-to-search)

```
use ONGR\ElasticsearchDSL\Query\Compound\BoolQuery;
use ONGR\ElasticsearchDSL\Query\FullText\MatchQuery;
use ONGR\ElasticsearchDSL\Query\TermLevel\TypeQuery;
use ONGR\ElasticsearchDSL\Search;
use DivanteLtd\PimcoreElasticsearchPlugin\Service\ElasticSearchService;

/** @var ElasticSearchService $elasticSearchService */
$elasticSearchService = \Pimcore::getDiContainer()->get(
    'DivanteLtd\PimcoreElasticsearchPlugin\Service\ElasticSearchService'
);
$boolQuery = new BoolQuery();
$boolQuery->addParameter("minimum_should_match", 1);
$boolQuery->addParameter("boost", 1);
$boolQuery->add(new TypeQuery('newsType'), BoolQuery::MUST);
$boolQuery->add(new MatchQuery('title', $query), BoolQuery::SHOULD);
$search = new Search();
$search
    ->addQuery($boolQuery)
    ->setFrom(0)
    ->setSize(10);
//reults should be array of News objects
$results = $elasticSearchService->find('newsType', $search);

```

For more examples take a look here:

About Authors
-------------

[](#about-authors)

[![Divante-logo](https://camo.githubusercontent.com/32ae2f618ad0d20e11616e5900acee1dcf70812ecb389b89d1c9bff1b6dac44b/687474703a2f2f646976616e74652e636f2f2f2f6c6f676f5f312e706e67 "Divante")](https://camo.githubusercontent.com/32ae2f618ad0d20e11616e5900acee1dcf70812ecb389b89d1c9bff1b6dac44b/687474703a2f2f646976616e74652e636f2f2f2f6c6f676f5f312e706e67)

We are a Software House from Europe, headquartered in Poland and employing about 150 people. Our core competencies are built around Magento, Pimcore and bespoke software projects (we love Symfony3, Node.js, Angular, React, Vue.js). We specialize in sophisticated integration projects trying to connect hardcore IT with good product design and UX.

Visit our website [Divante.co](https://divante.co/ "Divante.co") for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity69

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 ~18 days

Recently: every ~28 days

Total

8

Last Release

3123d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0fbad532f8fa3fe149afbeec5bf1cce720745c441f406b4373daa0d0ff600a79?d=identicon)[asprada](/maintainers/asprada)

![](https://www.gravatar.com/avatar/5d63320079c394c7a98b388d3236f946e870694b068a229775803cdae0fb6d74?d=identicon)[kkarkus](/maintainers/kkarkus)

![](https://www.gravatar.com/avatar/6c3d67b71166c00294f86551d887815f32de9f6e8bb636be77ec035063166cb6?d=identicon)[piotrbelina](/maintainers/piotrbelina)

![](https://www.gravatar.com/avatar/0970c20f4d5f756e712ef4f630118e4627b8d8f4278cbb9f50d9ec87f9573d5a?d=identicon)[lbond](/maintainers/lbond)

![](https://www.gravatar.com/avatar/1129f63bfa81223ebf1a8ea8e54c988ddc49b7a9940dd6e4cf414de1e26c272d?d=identicon)[colejarczyk](/maintainers/colejarczyk)

---

Top Contributors

[![kkarkus](https://avatars.githubusercontent.com/u/17312072?v=4)](https://github.com/kkarkus "kkarkus (11 commits)")

---

Tags

elasticsearchpimcorepimcore-pluginpluginelasticsearchpimcore

### Embed Badge

![Health badge](/badges/divante-ltd-pimcore-elasticsearch-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/divante-ltd-pimcore-elasticsearch-plugin/health.svg)](https://phpackages.com/packages/divante-ltd-pimcore-elasticsearch-plugin)
```

###  Alternatives

[10up/elasticpress

Supercharge WordPress with Elasticsearch.

1.3k374.3k6](/packages/10up-elasticpress)[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)[jsq/amazon-es-php

Support for using IAM authentication with the official Elasticsearch PHP client

9310.6M13](/packages/jsq-amazon-es-php)[10up/debug-bar-elasticpress

Extends the Debug Bar plugin for usage with ElasticPress

2917.0k](/packages/10up-debug-bar-elasticpress)

PHPackages © 2026

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