Skip to content

Commit

Permalink
Add --refresh to document command
Browse files Browse the repository at this point in the history
  • Loading branch information
jslay-excella committed May 26, 2022
1 parent 84a6409 commit dddd0f6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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):
Expand Down
1 change: 1 addition & 0 deletions cfgov/search/elasticsearch_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def rebuild_elasticsearch_index(*indices, stdout=sys.stdout):
"opensearch",
"document",
"index",
"--refresh",
*indices,
force=True,
stdout=stdout,
Expand Down
2 changes: 1 addition & 1 deletion refresh-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit dddd0f6

Please sign in to comment.