logstash mutate add\ u field-如何在python中索引

5rgfhyps  于 2021-06-15  发布在  ElasticSearch
关注(0)|答案(0)|浏览(253)

在编写索引时,我在logstash中使用以下内容:

mutate {add_field => [ "[NEW_FIELD_INT]","%{OLD_FIELD_STRING}" ]}
mutate {convert => {"NEW_FIELD_INT" => "integer"}

如何使用python使用它?
下面是我的转储片段:


# dump json to index

with open('\path\_file.json') as f:
    json_docs = json.loads(f.read())
    for json_doc in json_docs:
        my_id = json_doc.pop('_id', None)
        es.index(index=index_name, doc_type='_doc', id=my_id, body=json.dumps(json_doc))

谢谢你的帮助

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题