nimble/elastic-bundle

Simple elasticsearch Symfony integration.

Installs: 201

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 2

Open Issues: 0

Type:symfony-bundle

v0.50 2019-02-20 15:32 UTC

This package is not auto-updated.

Last update: 2024-04-16 18:55:33 UTC


README

Scrutinizer SensioLabsInsight

A simple bundle that integrates elasticsearch into your Symfony project using the official elasticsearch PHP client.

Why another elasticsearch bundle?

Most ES bundles I found assume that one entity is one ES document. This is very limiting, as very often denormalization is needed with more complex data. Your domain model does not need to be reflected in your elasticsearch mapping.

Also the most popular bundle does not give you an easy way to update the "master" document when any of your child entities change. This should be simple with this bundle.

This bundle directly exposes the official elasticsearch Client without wrapping it too much. I don't see much reason (besides rudimentary error checking) for using any query builders when most queries can be built dynamically as array and serialized to JSON directly.

This bundle provides only basic functionalities, which means you will have to write more code, but gives you flexiblity in return. For example:

  • A mechanism for synchronizing your entities with ES is provided (doctrine listeners or you have to dispatch create/update/delete events manually).
  • A mechanism for transforming your entities into ES documents is provided but you have to write the actual transformer yourself. This is better for performance and a must if you want flexibility. It also allows you completetly decouple the ES from your model (no unnecessary getters needed on your entities, yay!).
  • No mechnanism for automagically transforming ES results back into your entities will be ever provided (probably), because this would seriously limit the flexibility. Usually you could implement this yourself in a few lines, with your performance considerations in mind.

It will have great docs. ;)

Installation

The usual Symfony stuff.

The composer.json needs: "nimble/elastic-bundle": "dev-master@dev",.

The AppKernel.php needs: new Nimble\ElasticBundle\NimbleElasticBundle(),.