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


Python ElasticSearchController.update_docuemnt方法代码示例

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


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

示例1: delete_multiple_photos

# 需要导入模块: from elastic_controller import ElasticSearchController [as 别名]
# 或者: from elastic_controller.ElasticSearchController import update_docuemnt [as 别名]
def delete_multiple_photos(data):
	data = json.loads(data)
	full_size_img = [img_url.replace("thumbnail", "regular") for img_url in data.get("img_list")]
	
	prop_dict = {"user_id":data.get("user_id"), "sid":data.get("sid"), "property_id":data.get("property_id")}
	
	doc = get_property_details(json.dumps(prop_dict))
	property_photo = get_property_photo(data.get("img_list"),doc.get("data").get("thumbnails"))
	
	update_query = get_script_query_for_multiple(full_size_img,data.get("img_list"),property_photo)
	
	if not doc.get("data").get("project_id",""):
		map(lambda img_url:delete_photo_from_propshikari(img_url),data.get("img_list")) 
	es = ElasticSearchController()
	response = es.update_docuemnt("property", data.get("property_id"), update_query)
	prop_dict = {"user_id":data.get("user_id"), "sid":data.get("sid"), "property_id":data.get("property_id"), 
					"fields":["thumbnails", "full_size_images", "property_photo"]}
	prop_response = get_property_details(json.dumps(prop_dict))
	
	return { 
				"message":"Property Photo deleted successfully",
				"full_size_images":prop_response.get("data").get("full_size_images", []),
				"thumbnails":prop_response.get("data").get("thumbnails", []),
				"property_photo":prop_response.get("data").get("property_photo", [])
			}
开发者ID:arpitjain06,项目名称:propshikhari,代码行数:27,代码来源:property_update_api.py

示例2: add_photo_to_property

# 需要导入模块: from elastic_controller import ElasticSearchController [as 别名]
# 或者: from elastic_controller.ElasticSearchController import update_docuemnt [as 别名]
def add_photo_to_property(data):
	request_data = json.loads(data)
	prop_dict = {"user_id":request_data.get("user_id"), "sid":request_data.get("sid"), "property_id":request_data.get("property_id"), 
					"fields":["thumbnails", "full_size_images", "property_photo"]}
	field_dict = {}
	prop_response = get_property_details(json.dumps(prop_dict))
	if request_data.get("property_photos"):
		photo_dict = store_property_photos_in_propshikari(request_data.get("property_photos"),request_data.get("property_id"))
		photo_dict.get("full_size").extend(prop_response.get("data").get("full_size_images", []))
		photo_dict.get("thumbnails").extend(prop_response.get("data").get("thumbnails", []))
		field_dict["full_size_images"] = photo_dict.get("full_size")
		field_dict["thumbnails"] = photo_dict.get("thumbnails")
		field_dict["property_photo"] = field_dict.get("thumbnails")[0] if len(field_dict.get("thumbnails")) else ""
		search_query = {"doc": field_dict }
		es = ElasticSearchController()
		update_response = es.update_docuemnt("property", request_data.get("property_id"), search_query)
		prop_response = get_property_details(json.dumps(prop_dict))
		
		return { 
					"message":"Property Photos Updated successfully",
					"full_size_images":prop_response.get("data").get("full_size_images", []),
					"thumbnails":prop_response.get("data").get("thumbnails", []),
					"property_photo":prop_response.get("data").get("property_photo", [])
				}
	else:
		raise DoesNotExistError("Images not Attached")
开发者ID:arpitjain06,项目名称:propshikhari,代码行数:28,代码来源:property_update_api.py

示例3: update_project

# 需要导入模块: from elastic_controller import ElasticSearchController [as 别名]
# 或者: from elastic_controller.ElasticSearchController import update_docuemnt [as 别名]
def update_project(request_data):
	user_email = putil.validate_for_user_id_exists(request_data.get("fields").get("user_id"))
	try:
		field_dict = putil.validate_property_posting_data(request_data.get("fields"), "property_json/project_post_mapper.json")
		get_modified_datetime(field_dict, user_email)
		
		es = ElasticSearchController()
		update_project_photos(field_dict, request_data.get("fields"), request_data.get("project_id"), es)
		field_dict["possession_status"] = "Immediate" if field_dict.get("possession") else field_dict.get("possession_date")
		search_query = {"doc": field_dict }
		update_response = es.update_docuemnt("project", request_data.get("project_id"), search_query)
		percent_script = get_percent_completion_script(project_mandatory_fields)
		per_response = es.update_docuemnt("project", request_data.get("project_id"), percent_script)
		return {"opeartion":"Update", "message":"Project details Updated"}
	except elasticsearch.TransportError:
		raise DoesNotExistError("Project Id does not exists")
	except elasticsearch.ElasticsearchException,e:
		raise ElasticSearchException(e.error)
开发者ID:arpitjain06,项目名称:propshikhari,代码行数:20,代码来源:property_update_api.py

示例4: delete_project_photo

# 需要导入模块: from elastic_controller import ElasticSearchController [as 别名]
# 或者: from elastic_controller.ElasticSearchController import update_docuemnt [as 别名]
def delete_project_photo(doc, img_url):
	full, thumbnails, photo = init_for_photo_list_operation(doc, img_url)
	es = ElasticSearchController()
	search_query = {"doc":{ "full_size_images":full, "thumbnails":thumbnails, "project_photo":photo }}
	response = es.update_docuemnt("project", doc.get("project_id"), search_query)
	init_for_property_photo_update(es, img_url, doc.get("project_id"))
	return { 
				"message":"Project Photo deleted successfully",
				"full_size":','.join(full),
				"thumbnails":','.join(thumbnails),
				"photo":photo
			}
开发者ID:arpitjain06,项目名称:propshikhari,代码行数:14,代码来源:property_update_api.py

示例5: update_property_fields

# 需要导入模块: from elastic_controller import ElasticSearchController [as 别名]
# 或者: from elastic_controller.ElasticSearchController import update_docuemnt [as 别名]
def update_property_fields(data):
	request_data = json.loads(data)
	user_email = putil.validate_for_user_id_exists(request_data.get("user_id"))
	try:
		field_dict = get_updated_fields_dict(request_data, user_email)
		search_query = {"doc": field_dict }
		es = ElasticSearchController()
		update_response = es.update_docuemnt("property", request_data.get("property_id"), search_query)
		return {"opeartion":"Update", "message":"Property details Updated"}
	except elasticsearch.TransportError:
		raise DoesNotExistError("Property Id does not exists")
	except elasticsearch.ElasticsearchException,e:
		raise ElasticSearchException(e.error)
开发者ID:arpitjain06,项目名称:propshikhari,代码行数:15,代码来源:property_update_api.py

示例6: delete_property_photo

# 需要导入模块: from elastic_controller import ElasticSearchController [as 别名]
# 或者: from elastic_controller.ElasticSearchController import update_docuemnt [as 别名]
def delete_property_photo(doc, img_url):
	full_size_img = img_url.replace("thumbnail", "regular")
	update_query = get_script_query(full_size_img, img_url)
	if not doc.get("project_id","") or (img_url.find("PROP")!= -1):
		delete_photo_from_propshikari(img_url)
	es = ElasticSearchController()	
	response = es.update_docuemnt("property", doc.get("property_id"), update_query)
	prop_dict = {"user_id":doc.get("user_id"), "sid":doc.get("sid"), "property_id":doc.get("property_id"), 
					"fields":["thumbnails", "full_size_images", "property_photo"]}
	prop_response =get_property_details(json.dumps(prop_dict))
	return { 
				"message":"Property Photo deleted successfully",
				"full_size":','.join(prop_response.get("data").get("full_size_images", [])),
				"thumbnails":','.join(prop_response.get("data").get("thumbnails", [])),
				"photo":prop_response.get("data").get("property_photo", [])
			}
开发者ID:arpitjain06,项目名称:propshikhari,代码行数:18,代码来源:property_update_api.py

示例7: upadate_project_status

# 需要导入模块: from elastic_controller import ElasticSearchController [as 别名]
# 或者: from elastic_controller.ElasticSearchController import update_docuemnt [as 别名]
def upadate_project_status(request_data):
	email = putil.validate_for_user_id_exists(request_data.get("user_id"))
	putil.validate_property_data(request_data, ["project_id"])
	try:
		search_query = {"doc":{ "status":request_data.get("project_status") }}
		es = ElasticSearchController()
		response = es.update_docuemnt("project", request_data.get("project_id"), search_query)
		return {
				"operation":"Update" , 
				"message":"Project status changed" if response else "Project Status not changed", 
				"user_id":request_data.get("user_id")
				}
	except elasticsearch.TransportError:
		raise DoesNotExistError("Project Id does not exists")
	except elasticsearch.ElasticsearchException,e:
		raise ElasticSearchException(e.error)	
开发者ID:arpitjain06,项目名称:propshikhari,代码行数:18,代码来源:property_update_api.py

示例8: remove_tag_of_property

# 需要导入模块: from elastic_controller import ElasticSearchController [as 别名]
# 或者: from elastic_controller.ElasticSearchController import update_docuemnt [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.update_docuemnt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。