简体   繁体   English

Logstash / ElasticSearch-如何处理父母/子女关系

[英]Logstash/ElasticSearch - How to deal with parent/child relationship

I have added a mapping in my elastic search index in order to have a child for my documents: 我在弹性搜索索引中添加了一个映射,以便为我的文档提供子代:

PUT /test/_mapping/goals
{
  "goals": {
        "_all": {
           "enabled": false
        },
        "_parent": {
           "type": "myparentdoc"
        },
        "_routing": {
           "required": true,
           "path": "_id"
        },
        "properties": {
           "goals": {
              "type": "long",
              "null_value": 0
           }
        }
     }
  }

Now I would like to import the corresponding documents with logstash. 现在,我想使用logstash导入相应的文档。

How can I configure my logstash in order to give the parent id information. 如何配置我的logstash以提供父ID信息。

I tried to configure action parameter in elasticsearch output configuration without any success (based on elasticsearch documentation for bulk processing of children docs). 我试图在elasticsearch输出配置中配置动作参数,但没有成功(基于用于子文档批量处理的Elasticsearch文档)。

To summarize, how should I put _parent information? 总而言之,我应该如何放置_parent信息?

Any idea? 任何想法?

Thanks 谢谢

Finally I had just to add _parent information: 最后,我只需要添加_parent信息:

filter{
   mutate{
     add_field => { "_parent" => "%{_parentId}" }
   }

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM