diff --git a/src/Elasticsearch/Metadata/Resource/Factory/ElasticsearchProviderResourceMetadataCollectionFactory.php b/src/Elasticsearch/Metadata/Resource/Factory/ElasticsearchProviderResourceMetadataCollectionFactory.php index 129b78cb1e9..e94eeba4786 100644 --- a/src/Elasticsearch/Metadata/Resource/Factory/ElasticsearchProviderResourceMetadataCollectionFactory.php +++ b/src/Elasticsearch/Metadata/Resource/Factory/ElasticsearchProviderResourceMetadataCollectionFactory.php @@ -76,7 +76,7 @@ public function create(string $resourceClass): ResourceMetadataCollection : 'You will have to remove it when upgrading to v4'; trigger_deprecation('api-platform/core', '3.1', sprintf('Setting "elasticsearch" in GraphQlOperation is deprecated. %s', $solution)); } - if ($this->hasIndices($graphQlOperation)) { + if (null !== $elasticsearch && $this->hasIndices($graphQlOperation)) { $graphQlOperation = $graphQlOperation->withElasticsearch(true); }