当前位置: 首页>>代码示例>>Python>>正文


Python ElasticSearchController.bulk_upload方法代码示例

本文整理汇总了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")
开发者ID:arpitjain06,项目名称:propshikhari,代码行数:16,代码来源:propshikari_api.py

示例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)
开发者ID:arpitjain06,项目名称:propshikhari,代码行数:17,代码来源:project_api.py


注:本文中的elastic_controller.ElasticSearchController.bulk_upload方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。