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


Python ElasticSearchController.refresh_index方法代码示例

本文整理汇总了Python中elastic_controller.ElasticSearchController.refresh_index方法的典型用法代码示例。如果您正苦于以下问题:Python ElasticSearchController.refresh_index方法的具体用法?Python ElasticSearchController.refresh_index怎么用?Python ElasticSearchController.refresh_index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在elastic_controller.ElasticSearchController的用法示例。


在下文中一共展示了ElasticSearchController.refresh_index方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: shortlist_property

# 需要导入模块: from elastic_controller import ElasticSearchController [as 别名]
# 或者: from elastic_controller.ElasticSearchController import refresh_index [as 别名]
def shortlist_property(request_data):
	if request_data:
		request_data = json.loads(request_data)
		email = putil.validate_for_user_id_exists(request_data.get("user_id"))
		if not request_data.get("property_id"):
			raise MandatoryError("Mandatory Field Property Id missing")
		property_name = frappe.db.get_value("Shortlisted Property", {"property_id":request_data.get("property_id"), "user_id":request_data.get("user_id")} ,["name","status"], as_dict=1)
		if property_name:
			if property_name.get("status") == 'Active':	
				raise DuplicateEntryError("Property {0} already Shortlisted".format(request_data.get("property_id")))
			elif property_name.get("status") == 'Inactive':
				sp_doc = frappe.get_doc("Shortlisted Property", property_name.get("name"))
				sp_doc.status = "Active"
				sp_doc.save(ignore_permissions=True)
		else:
			try:
				sp_doc = frappe.new_doc("Shortlisted Property")
				sp_doc.user_id = request_data.get("user_id")
				sp_doc.property_id = request_data.get("property_id")
				sp_doc.status = "Active"
				sp_doc.save()
				es = ElasticSearchController()
				es.refresh_index()
			except frappe.MandatoryError,e:
				raise MandatoryError("Mandatory Field {0} missing".format(e.message))
			except (frappe.LinkValidationError, frappe.ValidationError)  as e:
				raise InvalidDataError(e.message)
			except Exception,e:
				raise OperationFailed("Shortlist Property Operation Failed")
开发者ID:arpitjain06,项目名称:propshikhari,代码行数:31,代码来源:property_masters.py

示例2: update_unpublished_property_flag

# 需要导入模块: from elastic_controller import ElasticSearchController [as 别名]
# 或者: from elastic_controller.ElasticSearchController import refresh_index [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

示例3: remove_tag_of_property

# 需要导入模块: from elastic_controller import ElasticSearchController [as 别名]
# 或者: from elastic_controller.ElasticSearchController import refresh_index [as 别名]
def remove_tag_of_property(data):
	request_data = json.loads(data)
	user_email = putil.validate_for_user_id_exists(request_data.get("user_id"))
	user_data = frappe.db.get_value("User",{"email":user_email}, "user_type", as_dict=True)
	if user_data.get("user_type") == "System User":
		try:
			es = ElasticSearchController()
			response = es.search_document_for_given_id("property",request_data.get("property_id"), [], [])
			get_modified_datetime(response, user_email)
			update_query = get_update_tag_query(request_data,request_data.get('tags')[0],response)
			es = ElasticSearchController()
			update_response = es.update_docuemnt("property", request_data.get("property_id"),update_query)
			es = ElasticSearchController()
			es.refresh_index()
			return {	
						"operation":"update", 
						"user_id":request_data.get("user_id"), 
						"message":"Property Tags Updated Successfully"
					}
		except elasticsearch.TransportError:
			raise DoesNotExistError("Property Id does not exists")
		except elasticsearch.ElasticsearchException,e:
			raise ElasticSearchException(e.error)					
开发者ID:arpitjain06,项目名称:propshikhari,代码行数:25,代码来源:property_update_api.py


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