Area: Product Issues
Sub-Area: Search and Index Synchronization
Applies to: OSS + Cloud
Issue
Soft-deleted datasets or users still show up in search results, for example after a bulk delete.
You may see this message on a soft-deleted entity page:
-
This entity is not discoverable via search or lineage graph. Contact your DataHub admin for more information.shown as an alert banner.
You Might Be Asking
- Why do soft-deleted datasets still appear when I search for them?
- How can I rebuild the search index after bulk deletions?
Cause
Search results come from the search index, not directly from the stored metadata. Restore indices rebuilds the search and graph indices from the stored metadata. It replays the latest version of each stored aspect.
By default, a restore indices run does not remove stale index documents for entities that no longer exist in the database. Removing those takes the -a clean option on the self-hosted job (see below).
Before you rebuild, check two things:
- A soft-deleted entity shows the "not discoverable" banner on its own page. The banner is not an error by itself.
- The Advanced Filter for soft-deleted status and the
includeSoftDeletedGraphQL search flag control whether soft-deleted entities appear in results. In the UI, check that filter first. See Advanced filters.
Solution
DataHub Cloud
You can't run restore indices yourself. Contact DataHub Support and:
- Ask for a restore indices run for the affected entity types (for example datasets and users).
- Name the affected instances (for example development or production) and the entity types that show the problem.
- After Support confirms the run is complete, check the search results again.
See how restore indices works.
Self-hosted
Choose the method by size. See the restore indices guide.
-
2,000 or more aspects (for example after a bulk delete): The docs strongly recommend the RestoreIndices job instead of the API. Run it as a Kubernetes job, or with Docker Compose run
./docker/datahub-upgrade/datahub-upgrade.sh -u RestoreIndices. The API runs inside one GMS instance and can time out. - Smaller sets: Call the Restore Indices endpoint on GMS. See the Restore Indices endpoint reference.
curl -X POST "https://<host>/api/gms/operations?action=restoreIndices" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"urnLike": "urn:li:dataset:%", "start": 0, "batchSize": 10}'
Parameters:
-
urn: restore one exact URN. -
aspect: restrict the run to one aspect. -
urnLike: a pattern that matches many URNs, for exampleurn:li:dataset:%for datasets orurn:li:corpuser:%for users. -
start: the offset to start from. Default 0.
Removing stale documents
If the index holds documents for entities that no longer exist in the database, run the job with -a clean:
./docker/datahub-upgrade/datahub-upgrade.sh -u RestoreIndices -a clean
clean empties the whole index first and ignores any urn or aspect filters. Take a backup first, and never run it in concurrent jobs.
Don't use datahub put to reindex. It writes a single aspect and requires --urn, -a/--aspect and -d/--aspect-data. It does not rebuild the index.
Undo a soft delete
If you want the entities back instead of removed from search, undo the soft delete with datahub delete undo-by-filter. datahub delete soft deletes by default. See How to Delete Metadata.
Related Documentation
- How to Delete Metadata in DataHub
- Restore indices
- Restore indices: how it works
- Restore Indices Rest.li endpoint
- Advanced filters in search
- Core vs Cloud: Comparison Guide
Tags: soft-delete, search-index, elasticsearch, bulk-operations, index-synchronization, datahub-cloud, reindexing