Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Opensearch Bundle Laravel Package

bneumann/opensearch-bundle

View on GitHub
Deep Wiki
Context7

OpenSearch Bundle

Packagist Version Packagist License Symfony Version OpenSearch

A Symfony bundle providing native OpenSearch integration. Inspired by FOSElasticaBundle, built for OpenSearch from the ground up.

Features

  • Multiple OpenSearch client support
  • Automatic Doctrine ORM synchronization
  • Blue/green reindexing with alias switching
  • Configurable object transformation (reflection, Symfony Serializer)
  • Repository pattern for search queries
  • Index templates
  • Event-driven extensibility (7 lifecycle events)
  • Console commands for index management

Requirements

  • PHP 8.1+
  • Symfony 6.4 / 7.x / 8.x
  • OpenSearch 2.x

Installation

composer require bneumann/opensearch-bundle

Quick Start

Configure a client and an index:

# config/packages/opensearch.yaml
opensearch:
  clients:
    default:
      hosts: ['https://localhost:9200']
      username: '%env(OPENSEARCH_USER)%'
      password: '%env(OPENSEARCH_PASS)%'
      ssl_verification: true
  indexes:
    products:
      index_name: 'products_%kernel.environment%'
      settings:
        number_of_shards: 1
        number_of_replicas: 0
      mappings:
        properties:
          name: { type: 'text' }
          sku: { type: 'keyword' }
      finder:
        hydration: orm
      persistence:
        driver: orm
        model: App\Entity\Product
        provider: true
        listener: true
        identifier: id

Create and populate the index:

bin/console opensearch:index:create products
bin/console opensearch:index:populate products

Search using the finder service:

use Bneumann\OpensearchBundle\Finder\FinderInterface;

public function __construct(private FinderInterface $finder) {}

$results = $this->finder->find([
    'query' => [
        'match' => ['name' => 'bike'],
    ],
]);

Or use the repository pattern:

use Bneumann\OpensearchBundle\Repository\Repository;

final class ProductRepository extends Repository
{
    public function findBySku(string $sku): iterable
    {
        return $this->search([
            'query' => ['term' => ['sku' => $sku]],
        ]);
    }
}

Documentation

Contributing

See CONTRIBUTING.md for guidelines.

License

This bundle is released under the MIT License.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
datacore/hub-sdk
alengo/sulu-http-cache-bundle
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
imbo/imbo-coding-standard
visualbuilder/filament-lottie
servicioslineaonce/starter-kit
atomcoder/laravel-reorderable
irajul/filament-shadcn-theme
agtp/agtp-php
agtp/mod-php
centraldesktop/protobuf-php
trappistes/laravel-custom-fields
splash/sonata-admin
splash/metadata