本文整理汇总了Python中elastic_controller.ElasticSearchController.bulk_upload方法的典型用法代码示例。如果您正苦于以下问题:Python ElasticSearchController.bulk_upload方法的具体用法?Python ElasticSearchController.bulk_upload怎么用?Python ElasticSearchController.bulk_upload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类elastic_controller.ElasticSearchController
的用法示例。
在下文中一共展示了ElasticSearchController.bulk_upload方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_unpublished_property_flag
# 需要导入模块: from elastic_controller import ElasticSearchController [as 别名]
# 或者: from elastic_controller.ElasticSearchController import bulk_upload [as 别名]
def update_unpublished_property_flag(request_data):
if request_data:
try:
property_data = prepare_query_of_published_properties(request_data.get("property_ids"))
es = ElasticSearchController()
response = es.bulk_upload(property_data)
es.refresh_index()
return {"operation":"Update" , "message":"Unpublished property status changed" if response else "upublished Status not changed", "user_id":request_data.get("user_id")}
except elasticsearch.TransportError:
raise DoesNotExistError("Property Id does not exists")
except elasticsearch.ElasticsearchException,e:
raise e
except Exception,e:
raise OperationFailed("Update Property Status Operation Failed")
示例2: init_for_property_posting
# 需要导入模块: from elastic_controller import ElasticSearchController [as 别名]
# 或者: from elastic_controller.ElasticSearchController import bulk_upload [as 别名]
def init_for_property_posting(project_data):
property_data = prepare_property_posting_data(project_data)
es = ElasticSearchController()
property_list = []
for prop in property_data:
new_prop = {}
custom_id = "PROP-" + cstr(int(time.time())) + '-' + cstr(random.randint(10000,99999))
prop["_op_type"] = "index"
prop["_index"] = "propshikari"
prop["_type"] = "property"
prop["_id"] = custom_id
prop["property_id"] = custom_id
new_prop.update(prop)
property_list.append(new_prop)
response_data = es.bulk_upload(property_list)