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

83 - ensure ancestry metadata keys are present in db index #84

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/pds/registrysweepers/ancestry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from pds.registrysweepers.utils import parse_args
from pds.registrysweepers.utils.db import write_updated_docs
from pds.registrysweepers.utils.db.client import get_opensearch_client
from pds.registrysweepers.utils.db.indexing import ensure_index_mapping
from pds.registrysweepers.utils.db.update import Update

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -46,6 +47,10 @@ def run(
updates = generate_updates(ancestry_records, ancestry_records_accumulator, bulk_updates_sink)

if bulk_updates_sink is None:
log.info("Ensuring metadata keys are present in database index...")
for metadata_key in [METADATA_PARENT_BUNDLE_KEY, METADATA_PARENT_COLLECTION_KEY]:
ensure_index_mapping(client, "registry", metadata_key, "keyword")

log.info("Writing bulk updates to database...")
write_updated_docs(client, updates)
else:
Expand Down
Loading