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
@@ -991,16 +991,21 @@ private function registerElasticsearchConfiguration(ContainerBuilder $container,
991
991
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.');
511
+
thrownewInvalidConfigurationException('The elasticsearch/elasticsearch or opensearch-project/opensearch-php package is required for Elasticsearch support.');
510
512
}
511
513
512
514
return$v;
@@ -526,6 +528,21 @@ private function addElasticsearchSection(ArrayNodeDefinition $rootNode): void
526
528
->defaultTrue()
527
529
->info('Enable or disable SSL verification for Elasticsearch connections.')
528
530
->end()
531
+
->enumNode('client')
532
+
->values(['elasticsearch', 'opensearch'])
533
+
->defaultValue('elasticsearch')
534
+
->info('The search engine client to use: "elasticsearch" or "opensearch".')
535
+
->validate()
536
+
->ifString()
537
+
->then(staticfunction (string$v): string {
538
+
if ('opensearch' === $v && !class_exists(\OpenSearch\Client::class)) {
539
+
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