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")
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)