diff --git a/cfgov/regulations3k/management/commands/update_regulation_index.py b/cfgov/regulations3k/management/commands/update_regulation_index.py index 2c4961c2849..5b93307f98a 100644 --- a/cfgov/regulations3k/management/commands/update_regulation_index.py +++ b/cfgov/regulations3k/management/commands/update_regulation_index.py @@ -3,6 +3,7 @@ from django.core.management import call_command from django.core.management.base import BaseCommand +from regulations3k.documents import SectionParagraphDocument from regulations3k.models import Part, Section @@ -11,7 +12,21 @@ def _run_elasticsearch_rebuild(): """Rebuild the Elasticsearch index after prepping section paragraphs.""" - call_command("opensearch", "index", "--force", "rebuild", "regulations3k") + call_command( + "opensearch", + "index", + "--force", + "rebuild", + SectionParagraphDocument.Index.name, + ) + call_command( + "opensearch", + "document", + "--force", + "--refresh", + "-i", + SectionParagraphDocument.Index.name, + ) class Command(BaseCommand): diff --git a/cfgov/search/elasticsearch_helpers.py b/cfgov/search/elasticsearch_helpers.py index 9d132968f06..fe153e75b70 100644 --- a/cfgov/search/elasticsearch_helpers.py +++ b/cfgov/search/elasticsearch_helpers.py @@ -171,6 +171,7 @@ def rebuild_elasticsearch_index(*indices, stdout=sys.stdout): "opensearch", "document", "index", + "--refresh", *indices, force=True, stdout=stdout, diff --git a/refresh-data.sh b/refresh-data.sh index c3d974f5f10..566836346bc 100755 --- a/refresh-data.sh +++ b/refresh-data.sh @@ -64,7 +64,7 @@ refresh_data() { update_index() { echo 'Updating search indexes' ./cfgov/manage.py opensearch index --force rebuild - ./cfgov/manage.py opensearch document --force index + ./cfgov/manage.py opensearch document --force --refresh --parallel index } get_data() {