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