$lastn not working - what am I missing

6 views
Skip to first unread message

Nazeem Soeltan

unread,
Jun 26, 2025, 2:57:32 PMJun 26
to HAPI FHIR
Hi,

I'm trying to get the $lastn working on the hapi-fhir-jpaserver-starter (locally).

This is the config:

elasticsearch:
  debug:
    pretty_print_json_log: true
    refresh_after_write: true
  enabled: true
  required_index_status: YELLOW
  rest_url: 'localhost:9200'
  protocol: 'http'
  schema_management_strategy: CREATE

hapi:
  fhir:
    lastn_enabled: true

I am using elasticsearch 7.17.3. In my docker-compose:

  hapi-fhir-elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.17.3
    container_name: hapi-fhir-elasticsearch
    restart: always
    environment:
      - discovery.type=single-node
    ports:
      - "9200:9200"
    networks:
      - elastic


I do see that the indexes are created (code_index, observation_index).

I created 2 patiens and for each 2 observations.

However, when I execute the query:
http://localhost:8080/fhir/Observation/$lastn?patient=Patient/JAN-ADRIANUS-J-A-H--JAN-VAN-HOUTEN

I do get back 4 results (which includes the two from the other patients).

I don't see any documents in either of the indices. I expect it to be indexed when inserting the observation. 

What am I missing?


Reply all
Reply to author
Forward
0 new messages