PHPackages                             xervice/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. xervice/elasticsearch

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

xervice/elasticsearch
=====================

1.2.2(7y ago)086MITPHPPHP &gt;=7.1.0

Since Apr 12Pushed 7y ago1 watchersCompare

[ Source](https://github.com/xervice/elasticsearch)[ Packagist](https://packagist.org/packages/xervice/elasticsearch)[ RSS](/packages/xervice-elasticsearch/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (6)Versions (6)Used By (0)

Elasticsearch
=============

[](#elasticsearch)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/818187e252c0705daa675dc2d3c869ee6398a89290e0234df4efc4d9a90dd652/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f786572766963652f656c61737469637365617263682f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/xervice/elasticsearch/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/bb52d697498ed90b781200affd607093ae549ca9a3e7e097881bd569c95018b5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f786572766963652f656c61737469637365617263682f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/xervice/elasticsearch/?branch=master)

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

[](#installation)

```
composer require xervice/elasticsearch:^1.0.0

```

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

[](#configuration)

*Your config*

```
    use Xervice\Elasticsearch\ElasticsearchConfig;

    $config[ElasticsearchConfig::HOST] = '127.0.0.1';
    $config[ElasticsearchConfig::PORT] = 9200;
```

*Define Index*

```
# Overwrite ElasticSearchDependencyProvider and add your IndexProvider

    /**
     * @return \Xervice\Elasticsearch\Dependency\Plugin\IndexProviderInterface[]
     */
    protected function getIndexProvider(): array
    {
        return [
            new CustomIndexProvider
        ];
    }

### Your Index-Provider must implement IndexProviderInterface and define your index and types
    /**
     * @param \Xervice\Elasticsearch\Business\Model\Index\IndexBuilderInterface $indexBuilder
     */
    public function createIndex(IndexBuilderInterface $indexBuilder, MappingConverterInterface $mappingConverter): void
    {
        $type = (new TypeDataProvider())
            ->setName('customtype')
            ->setMapping(
                $mappingConverter->convertToMapping(ElasticSearchTestDataProvider::class)
            );

        $index = (new IndexDataProvider())
            ->setName('customindex')
            ->setArguments(
                [
                    'number_of_shards' => 1,
                    'number_of_replicas' => 1
                ]
            )
            ->setDelete(false)
            ->addType($type);

        $indexBuilder->createIndex($index);
    }
```

\##Using *Create documents*

```
    $documentList = (new DocumentListDataProvider())
        ->setIndex('testindex')
        ->setType('testtype')
        ->addDocument(
            (new DocumentDataProvider())
                ->setIdent(1)
                ->setContent($customDataProvider->toArray())
        );

    $this->getFacade()->createDocuments($documentList);
```

*Search documents*

```
    $textQuery = new QueryString('SearchKey');
    $boolQuery = new BoolQuery();
    $boolQuery->addMust($textQuery);

    $query = new Query($boolQuery);

    $result = $this->getFacade()->search('testindex', $query, [], []);
```

Extended Search
---------------

[](#extended-search)

You can define your own QueryExtender and ResultFormatter and add them to your Search:

```
$result = $this->getFacade()->search(
    'testindex',
    $query,
    [
        new CustomSearchExtenderPlugin()
    ],
    [
        new CustomResultFormatterPlugin()
    ]
);
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Every ~1 days

Total

5

Last Release

2585d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9ba15174c6a847524e2118ff1b34670252159fa2bee234292381e090e3f1b3a1?d=identicon)[mibexx](/maintainers/mibexx)

---

Top Contributors

[![mibexx](https://avatars.githubusercontent.com/u/12134020?v=4)](https://github.com/mibexx "mibexx (12 commits)")

###  Code Quality

TestsCodeception

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[jolicode/elastically

Opinionated Elastica based framework to bootstrap PHP and Elasticsearch implementations.

2571.7M1](/packages/jolicode-elastically)[getcandy/candy-api

API driven E-commerce solution, written in Laravel

4427.9k1](/packages/getcandy-candy-api)[kunstmaan/search-bundle

The KunstmaanSearchBundle works with ElasticSearch and supports different search providers. The bundle currently supports Elastica as a provider. Add your own objects to index using a tagged service which implements the SearchConfigurationInterface

1884.8k1](/packages/kunstmaan-search-bundle)[heyday/silverstripe-elastica

Provides Elastic Search integration for SilverStripe DataObjects using Elastica

1136.8k2](/packages/heyday-silverstripe-elastica)[t3g/elasticorn

elastic manager based on elastica

155.8k](/packages/t3g-elasticorn)[michaeljennings/laralastica

A laravel package that allows you to search eloquent results using elasticsearch.

102.9k](/packages/michaeljennings-laralastica)

PHPackages © 2026

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