Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$reindex does not update lucene / elastic index #5864

Open
jnugh opened this issue Apr 22, 2024 · 0 comments
Open

$reindex does not update lucene / elastic index #5864

jnugh opened this issue Apr 22, 2024 · 0 comments

Comments

@jnugh
Copy link

jnugh commented Apr 22, 2024

Describe the bug
The $reindex operation does not recreate the resourcetable index when advancedHSearchIndexing is enabled. Even though data is being indexed when writing resources using POST / PUT.

To Reproduce
Steps to reproduce the behavior:

  1. Set up a server with elasticsearch index (using jpa starter enable: advanced_lucene_indexing, elasticsearch.*, hibernate.search.backend.type: elasticsearch)
  2. Create some Resources (e.g. using POST / PUT)
  3. Delete data from the elasticsearch index (or switch the options from above on at this point)
  4. POST to /fhir/$reindex
  5. Da a search e.g. using _contents

Expected behavior
It should return matching results after reindex, even though they have been manually removed from the index.

Environment (please complete the following information):

  • HAPI FHIR Version: jpa starter master (7.0.2)
  • OS: MacOS
  • Browser: n/a

Additional context
I did some debugging already. When updating an entity the lucene indexer creates a new elasticsearch document when
https://github.com/hapifhir/hapi-fhir/blob/master/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java#L2282

		return myTransactionService
				.withRequest(theRequest)
				.withTransactionDetails(theTransactionDetails)
				.withRequestPartitionId(requestPartitionId)
				.onRollback(onRollback)
				.execute(updateCallback);

is being called inside the update method.
During reindex this dos not happen. reindex calls reindexSearchParameters which correctly updates the index tables but does not write the resource itself. Thus never reaching the search index logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant