@task
def prepare_index(index_pk):
 from kuma.wiki.search import WikiDocumentType
 from kuma.search.models import Index
 cls = WikiDocumentType
 es = cls.get_connection('indexing')
 index = Index.objects.get(pk=index_pk)
 Index.objects.recreate_index(es=es, index=index)
 temporary_settings = {'index': {'refresh_interval': '-1', 'number_of_replicas': '0'}}
 es.indices.put_settings(temporary_settings, index=index.prefixed_name)

@ task def prepare_index ( index_pk ) : from kuma . wiki . search import WikiDocumentType from kuma . search . models import Index cls = WikiDocumentType es = cls . get_connection ( 'indexing' ) index = Index . objects . get ( pk = index_pk ) Index . objects . recreate_index ( es = es , index = index ) temporary_settings = { 'index' : { 'refresh_interval' : '-1' , 'number_of_replicas' : '0' } } es . indices . put_settings ( temporary_settings , index = index . prefixed_name )
prepare a new index for indexing documents into .