Skip to main content
Winter OpenSearch is a module that provides easy configuration and access to OpenSearch (or compatible search services) from Winter Boot applications. Each named entry in opensearch-config.yml builds an OpenSearch client and registers an OpenSearchTemplate bean, so you can talk to multiple clusters from the same service. When the swoole extension is loaded, requests are dispatched through a coroutine HTTP handler automatically.

Setup

Require the modules package with Composer (it pulls in opensearch-project/opensearch-php):
Enable the module in your application.yml:
configFile is a file path relative to your config directory or an absolute path.

opensearch-config.yml

Each entry under opensearch is a named cluster connection. Only name and hosts are mandatory.

Using basic authentication

Using Amazon OpenSearch Service (AWS)

Amazon OpenSearch Service (and OpenSearch Serverless) require every request to be signed with AWS Signature Version 4. Set the aws section and the module signs each request on top of the configured handler:

Autowired services

OpenSearchTemplate is the primary service for search operations. The first registered template is the default bean; refer to any other cluster by its name:

Connection properties

In the aws section, region is required, service defaults to es (use aoss for Serverless), and credentials may be omitted to use the default AWS provider chain (environment variables, IAM role, IRSA).

Document APIs

Cluster and index APIs

The template also exposes the OpenSearch namespaces for administration and monitoring:

Index migrations

Version your index templates, ISM policies, and index schemas as JSON files and apply them with the built-in migration runner, tracked the same way as SQL migrations. See OpenSearch Migrations.
For object storage alongside search, see the S3 module.