Commit a5a7372d authored by 段英荣's avatar 段英荣

add batch_recommend_user

parent 2f393f1a
...@@ -197,7 +197,7 @@ class ESPerform(object): ...@@ -197,7 +197,7 @@ class ESPerform(object):
result_dict["aggregations"] = res["aggregations"] result_dict["aggregations"] = res["aggregations"]
return result_dict return result_dict
else: else:
res = es_cli.msearch(body="\n".join(str(query_item) for query_item in query_body), index=official_index_name, doc_type=doc_type) res = es_cli.msearch(body=query_body index=official_index_name, doc_type=doc_type)
logging.info("duan add,msearch res:%s" % str(res)) logging.info("duan add,msearch res:%s" % str(res))
return res return res
......
...@@ -244,7 +244,10 @@ class UserUtils(object): ...@@ -244,7 +244,10 @@ class UserUtils(object):
batch_query_list.append(q) batch_query_list.append(q)
result_dict = ESPerform.get_search_results(ESPerform.get_cli(), sub_index_name="user", query_body=batch_query_list, query_body = ""
for query_item in batch_query_list:
query_body += "%s \n" % json.dumps(query_item)
result_dict = ESPerform.get_search_results(ESPerform.get_cli(), sub_index_name="user", query_body=query_body,
batch_search=True) batch_search=True)
return result_dict return result_dict
except: except:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment