feat(elasticsearch): OpenSearch support#7811
Merged
soyuka merged 3 commits intoapi-platform:mainfrom Mar 2, 2026
Merged
Conversation
f74d7ba to
1eeea25
Compare
soyuka
approved these changes
Mar 2, 2026
Member
soyuka
left a comment
There was a problem hiding this comment.
wow really nice addition! Thanks!
soyuka
approved these changes
Mar 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello,
Following up on #7519 — here's my take at adding OpenSearch support to the Elasticsearch bridge.
Given how similar the two clients are, it felt much simpler to patch the existing bridge rather than create a separate bundle that would have been little more than a copy with very little added value.
The idea is pretty simple: a new
clientoption underapi_platform.elasticsearchthat accepts either"elasticsearch"(default, nothing changes) or"opensearch". When set to"opensearch", the bridge usesopensearch-project/opensearch-phpinstead of the Elasticsearch client. The package is declared as asuggestso it stays fully optional.On the code side,
ElasticsearchClientPassbuilds the client throughOpenSearch\ClientBuilder::fromConfigwhen configured, and bothCollectionProviderandItemProvidernow acceptOpenSearch\Clientand catch itsMissing404Exception. The rest is config wiring and validation.Configuration looks like this:
CI-wise I added a PHPUnit matrix entry running the elasticsearch component tests with pensearch-php installed, plus a Behat job against an OpenSearch 2.19.4 container. Everything is green and existing Elasticsearch tests are unaffected. Full transparency: I'm not very familiar with GitHub Actions so Claude Code helped me a lot on that part.
Happy to adjust anything based on your feedback!
Fred