新增城市均价
This commit is contained in:
@@ -16,6 +16,8 @@ m_date = dateutils.iso_format()
|
|||||||
|
|
||||||
def build_doc(item):
|
def build_doc(item):
|
||||||
doc_dict = dict()
|
doc_dict = dict()
|
||||||
|
if 'city_avg_price' in item and pd.notna(item['city_avg_price']):
|
||||||
|
doc_dict['city_avg_price'] = item['city_avg_price']
|
||||||
if 'region_avg_price' in item and pd.notna(item['region_avg_price']):
|
if 'region_avg_price' in item and pd.notna(item['region_avg_price']):
|
||||||
doc_dict['region_avg_price'] = item['region_avg_price']
|
doc_dict['region_avg_price'] = item['region_avg_price']
|
||||||
if 'avg_price' in item and pd.notna(item['avg_price']):
|
if 'avg_price' in item and pd.notna(item['avg_price']):
|
||||||
@@ -108,18 +110,12 @@ def sync(city=None):
|
|||||||
|
|
||||||
actions.append(action)
|
actions.append(action)
|
||||||
if len(actions) == 5000:
|
if len(actions) == 5000:
|
||||||
try:
|
helpers.bulk(es206_client.elastic_client, actions)
|
||||||
helpers.bulk(es206_client.elastic_client, actions)
|
count += len(actions)
|
||||||
count += len(actions)
|
log.info("更新:" + str(count))
|
||||||
print("更新:" + str(count))
|
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
||||||
actions.clear()
|
actions.clear()
|
||||||
if len(actions) > 0:
|
if len(actions) > 0:
|
||||||
try:
|
helpers.bulk(es206_client.elastic_client, actions)
|
||||||
helpers.bulk(es206_client.elastic_client, actions)
|
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
||||||
actions.clear()
|
actions.clear()
|
||||||
log.info(f"完成同步价格信息至206 {index_name}")
|
log.info(f"完成同步价格信息至206 {index_name}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user