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
Given the following Repository @Repository public interface IndexDocumentRepository extends ElasticsearchRepository<IndexDocument, UUID>{ }
Calling IndexDocumentRepository.findById(UUID) with a return value of Optional<IndexDocument> may result in a org.springframework.data.elasticsearch.ResourceNotFoundException
How can one reproduce the bug?
Assuming the connection is setup and an Index exists, just calling findById(UUID.randomUUID()) should reproduce this bug
What is the expected behavior?
When the Index eixsts, but no Document with the given ID exists, the return value should be null
What is your host/environment?
Dependencies used:
Spring boot 3.3.1 with relevant starters
AWS SDK 2.27.10
spring-data-opensearch 1.5.2
Do you have any screenshots?
Excerpt of the stacktrace
org.springframework.data.elasticsearch.ResourceNotFoundException: server returned 404
at org.opensearch.data.client.osc.OpenSearchExceptionTranslator.translateExceptionIfPossible(OpenSearchExceptionTranslator.java:92)
at org.opensearch.data.client.osc.OpenSearchExceptionTranslator.translateException(OpenSearchExceptionTranslator.java:63)
at org.opensearch.data.client.osc.OpenSearchTemplate.execute(OpenSearchTemplate.java:700)
at org.opensearch.data.client.osc.OpenSearchTemplate.get(OpenSearchTemplate.java:148)
at org.springframework.data.elasticsearch.repository.support.SimpleElasticsearchRepository.lambda$findById$0(SimpleElasticsearchRepository.java:115)
at org.springframework.data.elasticsearch.repository.support.SimpleElasticsearchRepository.execute(SimpleElasticsearchRepository.java:448)
at org.springframework.data.elasticsearch.repository.support.SimpleElasticsearchRepository.findById(SimpleElasticsearchRepository.java:115)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:355)
at org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:277)
at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:170)
at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:158)
at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:516)
at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:285)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:628)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:173)
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:148)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:223)
at jdk.proxy2/jdk.proxy2.$Proxy295.findById(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:355)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:223)
at jdk.proxy2/jdk.proxy2.$Proxy296.findById(Unknown Source)
Do you have any additional context?
The Project is currently being updated from an older Spring version that was still using the Elasticsearch libraries, other calls to the opensearch instance do already work (for example, IndexOperations.existsTemplate)
The text was updated successfully, but these errors were encountered:
What is the bug?
Given the following Repository
@Repository public interface IndexDocumentRepository extends ElasticsearchRepository<IndexDocument, UUID>{ }
Calling
IndexDocumentRepository.findById(UUID)
with a return value ofOptional<IndexDocument>
may result in a org.springframework.data.elasticsearch.ResourceNotFoundExceptionHow can one reproduce the bug?
Assuming the connection is setup and an Index exists, just calling
findById(UUID.randomUUID())
should reproduce this bugWhat is the expected behavior?
When the Index eixsts, but no Document with the given ID exists, the return value should be null
What is your host/environment?
Dependencies used:
Spring boot 3.3.1 with relevant starters
AWS SDK 2.27.10
spring-data-opensearch 1.5.2
Do you have any screenshots?
Excerpt of the stacktrace
Do you have any additional context?
The Project is currently being updated from an older Spring version that was still using the Elasticsearch libraries, other calls to the opensearch instance do already work (for example, IndexOperations.existsTemplate)
The text was updated successfully, but these errors were encountered: