hapifhir / hapi-fhir

🔥 HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
2.04k stars 1.33k forks source link

Operation LastN not working with DaoConfig.ClientIdStrategyEnum.ANY and DaoConfig.IdStrategyEnum.UUID (HAPI 5.7.0) #3507

Open agnesguion opened 2 years ago

agnesguion commented 2 years ago

Describe the bug Operation LastN not working when resource client strategy is set to DaoConfig.ClientIdStrategyEnum.ANY and server id strategy to DaoConfig.IdStrategyEnum.UUID

To Reproduce Steps to reproduce the behavior: 1 Set the client id strategy to ANY 2 Create resource Observation 3 Call operation $lastN 4 See exception: ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException: HTTP 404 : HAPI-2001: Resource Observation/2 is not known

This can be reproduced in hapi-fhir-jpaserver-starter with test ca.uhn.fhir.jpa.starter.ElasticsearchLastNR4IT when adding hapi.fhir.client_id_strategy=ANY

Expected behavior Returned bundle with Observation

Environment :

Additional context I noticed that Observationin observation_index is now indexed with the resource PID but with the previous versions it was indexed with resource UUID.

dennisverspuij commented 2 years ago

This boils down to the same problem as described in my issue #3417, I have posted a patch that illustrates how it can (but probably not should) be solved.