from django.core.management import BaseCommand, CommandError
from corehq.pillows.case import get_couch_case_reindexer, get_sql_case_reindexer
from corehq.pillows.case_search import get_couch_case_search_reindexer
from corehq.pillows.xform import get_couch_form_reindexer, get_sql_form_reindexer


class Command(BaseCommand):
    args = 'index'
    help = 'Reindex a pillowtop index'

    def handle(self, index, *args, **options):
        reindex_fns = {
            'case': get_couch_case_reindexer,
            'form': get_couch_form_reindexer,
            'sql-case': get_sql_case_reindexer,
            'sql-form': get_sql_form_reindexer,
            'case-search': get_couch_case_search_reindexer
        }
        if index not in reindex_fns:
            raise CommandError('Supported indices to reindex are: {}'.format(','.join(reindex_fns.keys())))

        reindexer = reindex_fns[index]()
        reindexer.reindex()

from django.core.management import BaseCommand, CommandError
from corehq.pillows.case import get_couch_case_reindexer, get_sql_case_reindexer
from corehq.pillows.xform import get_couch_form_reindexer, get_sql_form_reindexer


class Command(BaseCommand):
    args = 'index'
    help = 'Reindex a pillowtop index'

    def handle(self, index, *args, **options):
        reindex_fns = {
            'case': get_couch_case_reindexer,
            'form': get_couch_form_reindexer,
            'sql-case': get_sql_case_reindexer,
            'sql-form': get_sql_form_reindexer,
        }
        if index not in reindex_fns:
            raise CommandError('Supported indices to reindex are: {}'.format(','.join(reindex_fns.keys())))

        reindexer = reindex_fns[index]()
        reindexer.reindex()

--- 
+++ 
@@ -1,5 +1,6 @@
 from django.core.management import BaseCommand, CommandError
 from corehq.pillows.case import get_couch_case_reindexer, get_sql_case_reindexer
+from corehq.pillows.case_search import get_couch_case_search_reindexer
 from corehq.pillows.xform import get_couch_form_reindexer, get_sql_form_reindexer
 
 
@@ -13,6 +14,7 @@
             'form': get_couch_form_reindexer,
             'sql-case': get_sql_case_reindexer,
             'sql-form': get_sql_form_reindexer,
+            'case-search': get_couch_case_search_reindexer
         }
         if index not in reindex_fns:
             raise CommandError('Supported indices to reindex are: {}'.format(','.join(reindex_fns.keys())))
Enable reindexing with v2 reindexer
