我想在浏览文档时立即添加上下文名称,我得到的是: -
{{
"key1": "test1",
"key2": "test2",
"key3": "test3",
"key4": "test4."
}}
我想要的其他地方是: -
{
"RouterAnomalyData":{
"key1": "test1",
"key2": "test2",
"key3": "test3",
"key4": "test4."
}
}
请指教??
答案 0 :(得分:0)
我曾希望-delimited_root_name
选项可以满足您的需求,但这只适用于XML。我已提交a request on GitHub来添加该功能。与此同时,您需要使用MLCP转换。见Transforming Input During Ingestion。你的功能看起来像这样:
function yourTransform(content, context)
{
// content.value is a document node. Convert to an object
// and wrap it with the new property.
const newDoc = {
"RouterAnomalyData": content.value.toObject()
}
// Update the content with the new document.
content.value = xdmp.unquote(xdmp.quote(newDoc));
return content;
}
然后,您可以install the transform和call the transform during ingest。这应该会产生你正在寻找的结构。