gbourgeat / elasticsearch-bundle
Elasticsearch bundle for Symfony.
Installs: 1 289
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 189
Type:symfony-bundle
Requires
- php: >=5.6
- doctrine/annotations: ~1.2
- doctrine/cache: ~1.4
- doctrine/collections: ~1.4
- doctrine/inflector: ~1.0
- gbourgeat/elasticsearch-dsl: ~5.0
- monolog/monolog: ~1.10
- symfony/console: ^2.8|^3.0
- symfony/framework-bundle: ^2.8|^3.0
- symfony/stopwatch: ^2.8|^3.0
- symfony/templating: ^2.8|^3.0
Requires (Dev)
- mikey179/vfsstream: ~1.4
- phpunit/phpunit: ~5.6
- satooshi/php-coveralls: ~1.0
- squizlabs/php_codesniffer: ~2.0
- symfony/browser-kit: ^2.8|^3.0
- symfony/dependency-injection: ^2.8|^3.0
- symfony/expression-language: ^2.8|^3.0
- symfony/options-resolver: ^2.8|^3.0
- symfony/serializer: ^2.8|^3.0
- symfony/twig-bundle: ^2.8|^3.0
- symfony/validator: ^2.8|^3.0
- symfony/yaml: ^2.8|^3.0
- v5.7.2.x-dev
- v5.7.2.4
- v5.7.2.3
- v5.7.2.2
- v5.7.2.1
- v5.7.2.0
- 5.0.x-dev
- v5.0.7
- v5.0.6
- v5.0.5
- v5.0.4
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0.0
- v5.0.0-rc3
- v5.0.0-rc2
- v5.0.0-rc1
- 1.2.x-dev
- v1.2.9
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- 1.1.x-dev
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- 1.0.x-dev
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v1.0.0-alpha.7
- v1.0.0-alpha.6
- v1.0.0-alpha.5
- v1.0.0-alpha.4
- v1.0.0-alpha.3
- v1.0.0-alpha.2
- v1.0.0-alpha.1
- v0.10.8
- v0.10.7
- v0.10.6
- v0.10.5
- v0.10.4
- v0.10.3
- v0.10.2
- v0.10.1
- v0.10.0
- v0.9.4
- v0.9.3
- v0.9.2
- v0.9.1
- v0.9.0
- v0.8.3
- v0.8.2
- v0.8.1
- v0.8.0
- v0.7.0
- v0.6.0
- v0.5.1
- v0.5.0
- v0.4.1
- v0.4.0
- v0.3.0
- v0.2.0
- v0.1.0
- dev-6.0-dev
- dev-legacy
This package is not auto-updated.
Last update: 2022-12-14 12:43:37 UTC
README
Elasticsearch Bundle was created in order to serve the need for professional Elasticsearch integration with enterprise level Symfony applications. This bundle is:
- Supported by ONGR.io development team.
- Uses the official elasticsearch-php client.
- Ensures full integration with Symfony framework.
Technical goodies:
- Provides interactive Document object generator via CLI (
ongr:es:document:generate
) - Provides DSL query builder to be executed by type repository services.
- Uses Doctrine-like documents(entities) document-object mapping using annotations.
- Query results iterators are provided for your convenience.
- Console CLI commands for index and types management and data import / export.
- Profiler that integrates in the Symfony debug bar and shows all executed queries.
- Designed in an extensible way for all your custom needs.
If you need any help, stack overflow is the preferred and recommended way to ask questions about ONGR bundles and libraries.
Version matrix
Elasticsearch version | ElasticsearchBundle version |
---|---|
>= 5.0 | ~5.x |
>= 2.0, < 5.0 | >=1.0, < 5.0 |
>= 1.0, < 2.0 | >= 0.10, < 1.0 |
<= 0.90.x | < 0.10 |
Documentation
The online documentation of the bundle can be found in http://docs.ongr.io.
Docs source is stored within the repo under Resources/doc/
, so if you see a typo or problem, please submit a PR to fix it!
For contribution to the documentation you can find it in the contribute topic.
FAQ
- Mapping explained
- Using Meta-Fields
- Configuration
- Console commands
- How to do a simple CRUD actions
- Quick find functions
- How to search the index
- Scan through the index
- Parsing the results
Setup the bundle
Step 1: Install Elasticsearch bundle
Elasticsearch bundle is installed using Composer.
php composer.phar require ongr/elasticsearch-bundle "~5.0"
Instructions for installing and deploying Elasticsearch can be found in Elasticsearch installation page.
Enable Elasticsearch bundle in your AppKernel:
// app/AppKernel.php public function registerBundles() { $bundles = [ // ... new ONGR\ElasticsearchBundle\ONGRElasticsearchBundle(), ]; // ... }
Step 2: Add configuration
Add minimal configuration for Elasticsearch bundle.
# app/config/config.yml ongr_elasticsearch: managers: default: index: index_name: acme mappings: - AppBundle
This is the very basic example only, for more information, please take a look at the configuration chapter.
In this particular example there are 2 things you should know. The index name in the index node and the mappings. Mappings is the place where your documents are stored (more info at the mapping chapter).
Step 3: Define your Elasticsearch types as Document
objects
This bundle uses objects to represent Elasticsearch documents. Lets create a Customer
class for customer document.
// src/AppBundle/Document/Customer.php namespace AppBundle\Document; use ONGR\ElasticsearchBundle\Annotation as ES; /** * @ES\Document() */ class Customer { /** * @var string * * @ES\Id() */ public $id; /** * @var string * * @ES\Property(type="text") */ public $name; }
This is the basic example only, for more information about mapping, please take a look at the the mapping chapter.
Step 4: Create index and mappings
Elasticsearch bundle provides several CLI
commands. One of them is for creating index, run command in your terminal:
bin/console ongr:es:index:create
More info about the rest of the commands can be found in the commands chapter.
Step 5: Enjoy with the Elasticsearch
We advise to take a look at the mapping chapter to configure the index. Search documentation for the Elasticsearch bundle is available here. And finally it's up to you what amazing things you are going to create 😎 .
Troubleshooting
License
This bundle is licensed under the MIT license. Please, see the complete license
in the bundle LICENSE
file.