弹性搜索中更改ID [英] Change ID in elasticsearch
本文介绍了弹性搜索中更改ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 ElasticSearch 遇到问题,如何更改 id
到日志文件中的另一个字段?
I'm having trouble with ElasticSearch, how can I change id
to another field in log file ?
推荐答案
在弹性搜索输出中,您可以为事件设置document_id运输。这将最终成为弹性搜索的一部分。您可以使用logstash config中提供的所有类型的参数/字段引用/ ...。像这样:
In the elasticsearch output you can set the document_id for the event you are shipping. This will end up being the _id in elasticsearch. You can use all sort of parameters / field references / ... that are available in logstash config. Like so:
elasticsearch {
host => yourEsHost
cluster => "yourCluster"
index => "logstash-%{+YYYY.MM.dd}"
document_id => "%{someFieldOfMyEvent}"
}
在这个例子中,someFieldOfMyEvent最终成为这个事件在ES中。
In this example someFieldOfMyEvent ends up being the _id of this event in ES.
这篇关于弹性搜索中更改ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文