PHPackages                             intracto/elastic-synonym - 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. intracto/elastic-synonym

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

intracto/elastic-synonym
========================

Update and refresh elasticsearch synonyms

2.0.0(6mo ago)0887↓100%1MITPHPPHP &gt;=8.0

Since Sep 15Pushed 6mo ago6 watchersCompare

[ Source](https://github.com/Intracto/elastic-synonym)[ Packagist](https://packagist.org/packages/intracto/elastic-synonym)[ RSS](/packages/intracto-elastic-synonym/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (4)Used By (1)

Intracto Elastic Synonym
========================

[](#intracto-elastic-synonym)

This library reads/writes elasticsearch synonyms and converts them into an array of editable objects. A refresh action can be called whenever you want to make the updated synonyms available for your users.

See `intracto/elastic-synonym-bundle` for a plug-and-play implementation for symfony 4.4+ using bootstrap.

Note: make sure you're using a query that supports analyzing, like the regular match filter (example below).

Additional requirements:

- Elasticsearch 7.3+
- Synonym filter must be applied to the search analyzer. It won't work for index analyzers

Installation
============

[](#installation)

```
$ composer require intracto/elastic_synonym
```

Synonym file on filesystem
==========================

[](#synonym-file-on-filesystem)

There are a few limitations we need to work around:

- Elasticsearch will *only* read wherever the current config file is located (usually `/etc/elasticsearch`)
- Our webuser on the filesystem will propably have not the permissions to write to the desired directory.

This is why we choose to work with a symlink. This can also be implemented as you want, but here is a working example using vagrant:

```
$ mkdir /vagrant/.elastic-synonym
$ touch /vagrant/.elastic-synonym/synonyms.txt # name the file anyway you want

$ sudo ln -s /vagrant/.elastic-synonym /etc/elasticsearch/analytics
```

Synonym filter in elastic
=========================

[](#synonym-filter-in-elastic)

Add the following filter under `settings.analysis.filter`:

```
'my_synonyms' => [ // a name for your filter
    'type' => 'synonym_graph',
    'synonyms_path' => 'analytics/synonyms.txt', // This needs to be the path inside /etc/elastic.
    'updateable' => true, // *must* be true
],
```

If you want to add it to your default search analyzer, add the following settings under `settings.analysis.analyzer`:

```
'default_search' => [
    // ..
    'filter' => [/*'..', */'my_synonyms'],
],
```

A simple example (assuming you're using defaults and added the filter to your default\_search):

```
$body['query']['bool']['should'][] = ['match' => ['description' => [
    'query' => 'this is an example',
    'fuzziness' => 'AUTO',
    'operator' => 'OR',
]]];
```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance66

Regular maintenance activity

Popularity17

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.5% 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 ~750 days

Total

3

Last Release

207d ago

Major Versions

0.1.0 → 1.0.02021-09-15

1.0.0 → 2.0.02025-10-24

PHP version history (2 changes)0.1.0PHP &gt;=7.1.3

2.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/57f44cb52273c29c230dbd1e9ef080402d53eaebcdd1fafbf5c6b75527b40199?d=identicon)[tvlooy](/maintainers/tvlooy)

![](https://www.gravatar.com/avatar/80809e7caf8341b1bac3d759e2b159a38b9bdab2deee5b0d4d66de6c83b992d1?d=identicon)[IntractoSupport](/maintainers/IntractoSupport)

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

---

Top Contributors

[![rvanginneken](https://avatars.githubusercontent.com/u/2691312?v=4)](https://github.com/rvanginneken "rvanginneken (7 commits)")[![tvlooy](https://avatars.githubusercontent.com/u/391674?v=4)](https://github.com/tvlooy "tvlooy (1 commits)")

### Embed Badge

![Health badge](/badges/intracto-elastic-synonym/health.svg)

```
[![Health](https://phpackages.com/badges/intracto-elastic-synonym/health.svg)](https://phpackages.com/packages/intracto-elastic-synonym)
```

###  Alternatives

[ruflin/elastica

Elasticsearch Client

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

PHP Client for OpenSearch

15224.3M65](/packages/opensearch-project-opensearch-php)[mailerlite/laravel-elasticsearch

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

934529.3k2](/packages/mailerlite-laravel-elasticsearch)[massive/search-bundle

Massive Search Bundle

721.4M13](/packages/massive-search-bundle)[shyim/opensearch-php-dsl

OpenSearch/Elasticsearch DSL library

175.9M9](/packages/shyim-opensearch-php-dsl)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

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

PHPackages © 2026

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