You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php
+9-4Lines changed: 9 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -988,16 +988,21 @@ private function registerElasticsearchConfiguration(ContainerBuilder $container,
988
988
thrownew \LogicException('Elasticsearch support cannot be enabled as the Elasticsearch component is not installed. Try running "composer require api-platform/elasticsearch".');
thrownewInvalidConfigurationException('The elasticsearch/elasticsearch package is required for Elasticsearch support.');
501
+
thrownewInvalidConfigurationException('The elasticsearch/elasticsearch or opensearch-project/opensearch-php package is required for Elasticsearch support.');
500
502
}
501
503
502
504
return$v;
@@ -516,6 +518,21 @@ private function addElasticsearchSection(ArrayNodeDefinition $rootNode): void
516
518
->defaultTrue()
517
519
->info('Enable or disable SSL verification for Elasticsearch connections.')
518
520
->end()
521
+
->enumNode('client')
522
+
->values(['elasticsearch', 'opensearch'])
523
+
->defaultValue('elasticsearch')
524
+
->info('The search engine client to use: "elasticsearch" or "opensearch".')
525
+
->validate()
526
+
->ifString()
527
+
->then(staticfunction (string$v): string {
528
+
if ('opensearch' === $v && !class_exists(\OpenSearch\Client::class)) {
529
+
thrownewInvalidConfigurationException('Setting api_platform.elasticsearch.client to "opensearch" requires the opensearch-project/opensearch-php package. Try running "composer require opensearch-project/opensearch-php".');
0 commit comments