Logstash / ElasticSearch - 如何处理父/子关系 [英] Logstash/ElasticSearch - How to deal with parent/child relationship

查看:358
本文介绍了Logstash / ElasticSearch - 如何处理父/子关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  PUT / test / _mapping / goals 
{
目标:{
_all:{
enabled:false
},
_parent {
type:myparentdoc
},
_routing:{
required:true,
path:_id

properties:{
goals:{
type:long,
null_value:0
}
}
}
}

现在我想导入相应的文件与logstash。



如何配置我的logstash以提供父ID信息。



我尝试在弹性搜索输出配置中配置操作参数没有任何成功(基于弹性搜索文档批量处理的孩子文档)。



总而言之,我应该如何将 _parent 信息?



任何想法?



谢谢

解决方案

最后我只是添加 _parent 信息:

  filter {
mutate {
add_field => {_parent=> %{_ parentId}}
}

}


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.

How can I configure my logstash in order to give the parent id information.

I tried to configure action parameter in elasticsearch output configuration without any success (based on elasticsearch documentation for bulk processing of children docs).

To summarize, how should I put _parent information?

Any idea?

Thanks

解决方案

Finally I had just to add _parent information:

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

}

这篇关于Logstash / ElasticSearch - 如何处理父/子关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆