Change ID in elasticsearch

前端 未结 1 1723
日久生厌
日久生厌 2021-01-04 05:37

I\'m having trouble with ElasticSearch, how can I change id to another field in log file ?

相关标签:
1条回答
  • 2021-01-04 05:47

    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}"
    } 
    

    In this example someFieldOfMyEvent ends up being the _id of this event in ES.

    0 讨论(0)
提交回复
热议问题