mixailshaulsky / elasticsearch-bundle
Elasticsearch bundle for Symfony.
Package info
github.com/mixailshaulsky/ElasticsearchBundle
Type:symfony-bundle
pkg:composer/mixailshaulsky/elasticsearch-bundle
v6.1.0-beta
2019-10-24 06:08 UTC
Requires
- php: ^7.1
- doctrine/annotations: ^1.6
- doctrine/cache: ^1.7
- doctrine/collections: ^1.5
- doctrine/inflector: ^1.3
- elasticsearch/elasticsearch: ^6.0
- monolog/monolog: ^1.24
- ongr/elasticsearch-dsl: ^6.0
- symfony/cache: ^3.4|^4.1
- symfony/console: ^3.4|^4.1
- symfony/dependency-injection: ^3.4|^4.1
- symfony/finder: ^3.4|^4.1
- symfony/framework-bundle: ^3.4|^4.1
- symfony/property-access: ^3.4|^4.1
- symfony/serializer: ^3.4|^4.1
- symfony/stopwatch: ^3.4|^4.1
- symfony/templating: ^3.4|^4.1
Requires (Dev)
- mikey179/vfsstream: ~1.6
- php-coveralls/php-coveralls: ^2.1
- phpunit/phpunit: ^7.0
- squizlabs/php_codesniffer: ^3.0
- symfony/browser-kit: ^3.4|^4.1
- symfony/expression-language: ^3.4|^4.1
- symfony/options-resolver: ^3.4|^4.1
- symfony/twig-bundle: ^3.4|^4.1
- symfony/validator: ^3.4|^4.1
- symfony/yaml: ^3.4|^4.1
This package is not auto-updated.
Last update: 2026-06-05 17:35:21 UTC
README
This is the fork ONGR Elasticsearch Bundle with ability to customize Index similarity
Step 1: Configure bundle
# config/packages/ongr_elasticsearch.yaml ongr_elasticsearch: analysis: filter: edge_ngram_filter: #-> your custom filter name to use in the analyzer below type: edge_ngram min_gram: 1 max_gram: 20 analyzer: eNgramAnalyzer: #-> analyzer name to use in the document field type: custom tokenizer: standard filter: - lowercase - edge_ngram_filter #that's the filter defined earlier similarity: scripted_tfidf: type: scripted script: source: "double tf = Math.sqrt(doc.freq); double idf = 1.0; double norm = 1/Math.sqrt(doc.length); return query.boost * tf * idf * norm;" indexes: App\Document\Product: hosts: [elasticsearch:9200] # optional, the default is 127.0.0.1:9200
Step 2: Configure your custom similarity for Document field
// src/Document/Product.php namespace App\Document; use ONGR\ElasticsearchBundle\Annotation as ES; /** * //alias and default parameters in the annotation are optional. * @ES\Index(alias="products", default=true) */ class Product { /** * @ES\Id() */ public $id; /** * @ES\Property(type="text", similarity="scripted_tfidf") */ public $title; /** * @ES\Property(type="float") */ public $price; }