def index_webapp(ids, **kw): index = kw.pop('index', None) or ALIAS sys.stdout.write('Indexing %s apps' % len(ids)) qs = Webapp.indexing_transformer(Webapp.uncached.filter(id__in=ids)) docs = [WebappIndexer.extract_document(obj.id, obj=obj) for obj in qs] WebappIndexer.bulk_index(docs, es=ES, index=index)
def index_webapps(ids, **kw): task_log.info('Indexing apps %s-%s. [%s]' % (ids[0], ids[-1], len(ids))) index = kw.pop('index', WebappIndexer.get_index()) # Note: If reindexing is currently occurring, `get_indices` will return # more than one index. indices = get_indices(index) es = WebappIndexer.get_es(urls=settings.ES_URLS) qs = Webapp.indexing_transformer(Webapp.uncached.filter(id__in=ids)) for obj in qs: doc = WebappIndexer.extract_document(obj.id, obj) for idx in indices: WebappIndexer.index(doc, id_=obj.id, es=es, index=idx)
def index_webapp(ids, **kw): index = kw.pop('index', None) or ALIAS sys.stdout.write('Indexing %s apps' % len(ids)) qs = Webapp.indexing_transformer(Webapp.uncached.filter(id__in=ids)) docs = [] for obj in qs: try: docs.append(WebappIndexer.extract_document(obj.id, obj=obj)) except: sys.stdout.write('Failed to index obj: {0}'.format(obj.id)) WebappIndexer.bulk_index(docs, es=ES, index=index)
def index_webapp(ids, **kw): index = kw.pop("index", None) or ALIAS sys.stdout.write("Indexing %s apps" % len(ids)) qs = Webapp.indexing_transformer(Webapp.with_deleted.no_cache().filter(id__in=ids)) docs = [] for obj in qs: try: docs.append(WebappIndexer.extract_document(obj.id, obj=obj)) except: sys.stdout.write("Failed to index obj: {0}".format(obj.id)) WebappIndexer.bulk_index(docs, es=ES, index=index)
def index_webapp(ids, **kw): index = kw.pop('index', None) or ALIAS sys.stdout.write('Indexing %s apps' % len(ids)) qs = Webapp.indexing_transformer( Webapp.with_deleted.no_cache().filter(id__in=ids)) docs = [] for obj in qs: try: docs.append(WebappIndexer.extract_document(obj.id, obj=obj)) except: sys.stdout.write('Failed to index obj: {0}'.format(obj.id)) WebappIndexer.bulk_index(docs, es=ES, index=index)
def _get_doc(self): qs = Webapp.indexing_transformer( Webapp.uncached.filter(id__in=[self.app.pk])) obj = qs[0] return obj, WebappIndexer.extract_document(obj.pk, obj)