PHPackages                             zhortein/elastic-entity-bundle - 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. [Database &amp; ORM](/categories/database)
4. /
5. zhortein/elastic-entity-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

zhortein/elastic-entity-bundle
==============================

This bundle handles doctrine like entities stored in ELK stack.

05PHP

Since Aug 6Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/Zhortein/elastic-entity-bundle)[ Packagist](https://packagist.org/packages/zhortein/elastic-entity-bundle)[ RSS](/packages/zhortein-elastic-entity-bundle/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

ElasticEntityBundle
===================

[](#elasticentitybundle)

[![PHP Version](https://camo.githubusercontent.com/5c8ce4571ddf4b6b8ca847e0c4c079de98fc6460eb7eae9c81ca63319c21f546/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e332d626c75652e737667)](https://php.net/)[![Symfony Version](https://camo.githubusercontent.com/da2318a06a50fc1c57f3067fd6250f7964bd9562d0d06bf998f24e4110634e3a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73796d666f6e792d253345253344372e332d677265656e2e737667)](https://symfony.com/)[![License](https://camo.githubusercontent.com/c96bfd71a337d071b4504c366a054f82f86b1caff458e033f96d1c6419039e9f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c2d2d332e302d2d6f722d2d6c617465722d7265642e737667)](LICENSE)

A Symfony bundle that provides Doctrine-like entity management for Elasticsearch, allowing you to work with Elasticsearch documents using familiar ORM patterns.

🚀 Features
----------

[](#-features)

### Core Entity Management

[](#core-entity-management)

- **Entity-like Management**: Use PHP 8.3+ attributes to define `ElasticEntity`, `ElasticField`, and `ElasticRelation`
- **Relations Support**: Handle `reference` and `nested` relations between entities
- **Complete CRUD Operations**: persist, remove, flush, find, findBy, findOneBy
- **Document Versioning**: Optimistic concurrency control with version management
- **Refresh Control**: Control when documents are refreshed in the index

### Index Management

[](#index-management)

- **Index Operations**: Create, delete, and check index existence
- **Index Settings**: Configure shards, replicas, refresh intervals, and analysis settings
- **Index Templates**: Create, update, delete, and manage index templates
- **Index Aliases**: Create, delete, and manage index aliases
- **Index Information**: Retrieve detailed index settings and mappings

### Advanced Search &amp; Queries

[](#advanced-search--queries)

- **Query Types**: Support for match, term, range, bool, and custom queries
- **Full-text Search**: Custom analyzers and advanced text analysis
- **Filters &amp; Post-filters**: Complex filtering capabilities
- **Multi-column Sorting**: Advanced sorting options
- **Pagination**: Both offset-based (from/size) and cursor-based (search\_after) pagination
- **Result Highlighting**: Search result highlighting with customizable options
- **Aggregations**: Terms, date histogram, stats, and custom aggregations
- **Scroll API**: Efficient processing of large result sets
- **Multi-index Search**: Search across multiple indices simultaneously

### Bulk Operations

[](#bulk-operations)

- **Bulk Insert**: Efficient batch document creation
- **Bulk Update**: Batch document updates
- **Bulk Delete**: Batch document deletion
- **Bulk Mixed Operations**: Combine different operations in a single request

### Maintenance &amp; Performance

[](#maintenance--performance)

- **Reindex API**: Copy documents from one index to another with optional filtering
- **Index Refresh**: Manual index refresh operations
- **Index Flush**: Force index flush operations
- **Cache Management**: Clear query, fielddata, and request caches
- **Force Merge**: Optimize index segments for better performance

### Integration &amp; Development

[](#integration--development)

- **Event System**: Lifecycle events (pre/post persist, update, remove)
- **Form Integration**: Seamless integration with Symfony Forms
- **Validation**: Built-in validation support using Symfony constraints
- **Metrics**: Query performance metrics and monitoring
- **Docker Ready**: Complete Docker development environment included

📋 Requirements
--------------

[](#-requirements)

- **PHP**: &gt;= 8.3
- **Symfony**: &gt;= 7.3
- **Elasticsearch**: &gt;= 8.15

🛠 Installation
--------------

[](#-installation)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require zhortein/elastic-entity-bundle
```

### 2. Enable the Bundle

[](#2-enable-the-bundle)

The bundle should be automatically enabled. If not, add it to `config/bundles.php`:

```
