[英]Elasticsearch pipeline to extract fields of an object to a root of document
I'm looking for a way to extract the contents of an object such as 我正在寻找一种提取对象内容的方法,例如
{
"mdc":{
"key1": "value1",
"key2": "value2",
...
}
}
and transform that into 并将其转化为
{
"key1": "value1",
"key2": "value2",
...
"mdc":{
"key1": "value1",
"key2": "value2"
}
}
I was looking at the provided processors but couldn't find anything useful. 我正在查看提供的处理器,但找不到任何有用的东西。
My initial thought was to: 我最初的想法是:
Any suggestions would be greatly appreciated! 任何建议将不胜感激!
It wasn't that hard after all. 毕竟并不难。
{
"mdcflatten": {
"processors": [
{
"script": {
"lang": "painless",
"inline": " ctx.mdc.keySet().each (key -> ctx[key] = ctx.mdc.get(key))"
}
},
{
"remove": {
"field": "mdc"
}
}
]
}
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.