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 inopensearch-project/opensearch-php):
configFile is a file path relative to your config directory or an absolute path.
opensearch-config.yml
Each entry underopensearch 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 theaws 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).