51 lines
1.0 KiB
Python
51 lines
1.0 KiB
Python
# --------------------------- modularity
|
|
from app.common.elastic_helper import ElasticHelper
|
|
from base_model import MnTerm
|
|
|
|
# --------------------------- global-params
|
|
input_es_index_name = ''
|
|
base_index_name = 'monir_test_term'
|
|
id_data = None
|
|
_data = None
|
|
|
|
|
|
# --------------------------- function
|
|
def conver_mn_term(old_data) -> MnTerm:
|
|
new_data = {
|
|
id: str
|
|
main_type: str
|
|
sub_type: str
|
|
title: str
|
|
content: str
|
|
author: str
|
|
begin_date: datetime
|
|
end_date: datetime
|
|
begin_year: int
|
|
tags: str
|
|
keywords: str
|
|
}
|
|
|
|
|
|
# --------------------------- flow
|
|
es_helper = ElasticHelper(
|
|
es_url="http://127.0.0.1:6900",
|
|
es_user="elastic",
|
|
# es_pass="",
|
|
# path_mappings = ""
|
|
)
|
|
|
|
|
|
es_helper.update_index_doc(
|
|
is_update_state=False,
|
|
index_name_o=base_index_name,
|
|
eid=id_data,
|
|
data=_data
|
|
)
|
|
|
|
# --------------------------- RUN
|
|
# ------ command
|
|
# --liunx
|
|
# python3 -m app.monir.sanad_stuff.py
|
|
# --windows
|
|
# python -m app.monir.sanad_stuff.py
|