标签:文件导入 arc article 导入 数据 doc open enc tags
def zi_dr(request): f = open(‘c.txt‘, ‘r‘, encoding=‘utf-8‘) action = [ { "_index": "c12", "_type": "doc", "_source": { "title": i.strip(), # 去掉 空 } } for i in f] s = time.time() helpers.bulk(es, action) print(time.time() - s) return HttpResponse("ok")
def es2(request):
query_obj = models.Article.objects.all() action = ( { "_index": "s18", "_type": "doc", "_source": { "title": i.title, "summary": i.summary, "a_url": i.a_url, "img_url": i.img_url, "tags": i.tags } } for i in query_obj) # print(action, next(action)) import time s = time.time() helpers.bulk(es, action) print(time.time() - s) return HttpResponse(‘OK‘)
标签:文件导入 arc article 导入 数据 doc open enc tags
原文地址:https://www.cnblogs.com/sc-1067178406/p/10920435.html