diff --git a/pillar/api/search/index.py b/pillar/api/search/index.py index 4d6cdb4b..0acd34b6 100644 --- a/pillar/api/search/index.py +++ b/pillar/api/search/index.py @@ -41,11 +41,10 @@ class ResetIndexTask(object): try: idx.delete(ignore=404) - log.info("Deleted index %s", index) except NotFoundError: log.warning("Could not delete index '%s', ignoring", index) else: - log.warning("Could not delete index '%s', ignoring", index) + log.info("Deleted index %s", index) # create doc types for dt in self.doc_types: diff --git a/pillar/celery/search_index_tasks.py b/pillar/celery/search_index_tasks.py index e88ba15a..09370b4c 100644 --- a/pillar/celery/search_index_tasks.py +++ b/pillar/celery/search_index_tasks.py @@ -126,7 +126,7 @@ def prepare_user_data(user_id: str, user=None) -> dict: user = users_coll.find_one({'_id': user_oid}) if user is None: - log.warning('Unable to find user %s, not updating Algolia.', user_id) + log.warning('Unable to find user %s, not updating search index.', user_id) return {} user_roles = set(user.get('roles', ())) diff --git a/pillar/cli/elastic.py b/pillar/cli/elastic.py index 2bc8b794..270a80a6 100644 --- a/pillar/cli/elastic.py +++ b/pillar/cli/elastic.py @@ -42,6 +42,9 @@ def reset_index(indices): def _reindex_users(): db = current_app.db() users_coll = db['users'] + + # Note that this also finds service accounts, which are filtered out + # in prepare_user_data(…) users = users_coll.find() user_count = users.count()