Slot search returning outdated status values

6 views
Skip to first unread message

Leonel Peña

unread,
Nov 3, 2025, 1:18:48 PM (7 days ago) Nov 3
to HAPI FHIR

Hi everyone,

I’m seeing an issue in HAPI FHIR when querying Slot resources. After I update a Slot’s status from free to busy, if I immediately perform the following search:

the Slot still appears in the results for a while, even though its status was already changed to busy. Only after some time does it stop showing up.

Is this expected behavior due to indexing delay, caching, or some configuration related to search result reuse?
Is there a way to force the index to refresh right after an update, or to avoid returning stale data in searches?

Any guidance would be greatly appreciated.

James Agnew

unread,
Nov 3, 2025, 1:32:25 PM (7 days ago) Nov 3
to Leonel Peña, HAPI FHIR
You are probably getting a cached search result. If you're actively making changes which would affect the search results at the same time you are making queries dependent on those changes, you can request that the cache be skipped using the Cache-Control header: https://smilecdr.com/docs/fhir_storage_relational/performance_and_caching.html#controlling-the-query-cache-client

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/hapi-fhir/6d67cd1f-dbcf-4361-b29f-5a3d894fa9dcn%40googlegroups.com.

Leonel Peña

unread,
Nov 5, 2025, 10:38:34 AM (5 days ago) Nov 5
to HAPI FHIR
Thanks for the tip. While testing the solution, I added the Cache-Control header, but when using no-store some _include results are not being included.
Is this expected behavior?  

James Agnew

unread,
Nov 5, 2025, 10:44:23 AM (5 days ago) Nov 5
to Leonel Peña, HAPI FHIR
No, that's definitely not expected. Weird!

Are you able to replicate with a query on hapi.fhir.org ?

Leonel Peña

unread,
Nov 5, 2025, 10:58:30 AM (5 days ago) Nov 5
to HAPI FHIR
Yes, if you test with this request, when you add the header with no-store, no _include information is returned. Maybe I’m doing it wrong?  


With Cache-Control:no-cache, no-store, max-items=1
{
    "resourceType": "Bundle",
    "id": "b49b3ade-52a6-481b-8262-90e90e2efea5",
    "meta": {
        "lastUpdated": "2025-11-05T15:49:01.528+00:00"
    },
    "type": "searchset",
    "total": 110,
    "link": [
        {
            "relation": "self",
        }
    ],
    "entry": [
        {
            "fullUrl": "https://hapi.fhir.org/baseR4/Slot/48939888",
            "resource": {
                "resourceType": "Slot",
                "id": "48939888",
                "meta": {
                    "versionId": "1",
                    "lastUpdated": "2025-08-30T07:56:01.053+00:00",
                    "source": "#Ia8vTAtZq8IKOEMY"
                },
                "schedule": {
                    "reference": "Schedule/47814491"
                },
                "status": "free",
                "start": "2025-11-04T09:00:00+00:00",
                "end": "2025-11-04T09:30:00+00:00",
                "comment": "Auto-generated 30m slot"
            },
            "search": {
                "mode": "match"
            }
        }
    ]
}

With Cache-Control:no-cache
{
    "resourceType": "Bundle",
    "id": "539eb918-b6f0-4d00-9581-4040c9d2ea55",
    "meta": {
        "lastUpdated": "2025-11-05T15:55:45.182+00:00"
    },
    "type": "searchset",
    "total": 110,
    "link": [
        {
            "relation": "self",
        },
        {
            "relation": "next",
        }
    ],
    "entry": [
        {
            "fullUrl": "https://hapi.fhir.org/baseR4/Slot/51702664",
            "resource": {
                "resourceType": "Slot",
                "id": "51702664",
                "meta": {
                    "versionId": "1",
                    "lastUpdated": "2025-11-03T05:12:07.302+00:00",
                    "source": "#M3INmrZMQvh0N6D4"
                },
                "serviceCategory": [
                    {
                        "coding": [
                            {
                                "system": "http://terminology.hl7.org/CodeSystem/service-category",
                                "code": "17",
                                "display": "General Practice"
                            }
                        ]
                    }
                ],
                "serviceType": [
                    {
                        "coding": [
                            {
                                "system": "http://snomed.info/sct",
                                "code": "394537008",
                                "display": "Pediatrics"
                            }
                        ]
                    }
                ],
                "specialty": [
                    {
                        "coding": [
                            {
                                "system": "http://snomed.info/sct",
                                "code": "394537008",
                                "display": "Pediatrics"
                            }
                        ]
                    }
                ],
                "schedule": {
                    "reference": "Schedule/51702637"
                },
                "status": "free",
                "start": "2025-11-04T09:00:00",
                "end": "2025-11-04T09:30:00"
            },
            "search": {
                "mode": "match"
            }
        },
        {
            "fullUrl": "https://hapi.fhir.org/baseR4/Schedule/51702637",
            "resource": {
                "resourceType": "Schedule",
                "id": "51702637",
                "meta": {
                    "versionId": "1",
                    "lastUpdated": "2025-11-03T05:11:57.444+00:00",
                    "source": "#N6lyr4r2EcgUWA98"
                },
                "active": true,
                "serviceCategory": [
                    {
                        "coding": [
                            {
                                "system": "http://terminology.hl7.org/CodeSystem/service-category",
                                "code": "17",
                                "display": "General Practice"
                            }
                        ]
                    }
                ],
                "serviceType": [
                    {
                        "coding": [
                            {
                                "system": "http://snomed.info/sct",
                                "code": "394537008",
                                "display": "Pediatrics"
                            }
                        ]
                    }
                ],
                "specialty": [
                    {
                        "coding": [
                            {
                                "system": "http://snomed.info/sct",
                                "code": "394537008",
                                "display": "Pediatrics"
                            }
                        ]
                    }
                ],
                "actor": [
                    {
                        "reference": "Practitioner/51701692",
                        "display": "Dr. Lisa Thompson"
                    }
                ],
                "planningHorizon": {
                    "start": "2025-11-03T10:41:56.782967",
                    "end": "2025-12-03T10:41:56.782967"
                },
                "comment": "Schedule for Dr. Lisa Thompson - Pediatrics"
            },
            "search": {
                "mode": "include"
            }
        }
    ]
}

Reply all
Reply to author
Forward
0 new messages