我刚开始使用 X-Pack for Elasticsearch 并希望连接来自嵌套文档类型的顶点。但是,寻找这方面的文档并没有帮助我。
我有一个文档索引,其中包含人名/ID 作为嵌套文档(一个文档可以有很多人,一个人可以与许多文档相关)。期望的结果是得到一个人与人之间有联系的图数据。
有没有人知道或者可以告诉我这是否可能?
我的部分映射:
mappings: {
legend: {
properties: {
persons: {
type: 'nested',
properties: {
id: {
type: 'string',
index: 'not_analyzed'
},
name: {
type: 'string',
index: 'not_analyzed'
}
}
}
}
}
}
还有我的图谱 API 查询,这当然不起作用,因为我不知道如何处理嵌套“人员”字段的“姓名”字段。
POST sagenkarta_v3/_xpack/_graph/_explore
{
"controls": {
"use_significance": true,
"sample_size": 20000,
"timeout": 2000
},
"vertices": [
{
"field": "persons.name"
}
],
"connections": {
"vertices": [
{
"field": "persons.name"
}
]
}
}
提前致谢!
最佳答案
引自 Mark_Harwood - Elastic 团队成员:
Unfortunately Graph does not support nested documents but you can use copy_to in your mappings to put the person data in an indexed field in the containing root document.
I can see that you have the classic problem of "computers-want-IDs-but-people-want-labels" and have both these values. In Graph (and arguably the rest of Kibana too) I suggest you use tokens that combine IDs for uniqueness' sake and names for readability by humans.
The copy_to and IDs-and-labels tips are part of the modelling suggestions in my elasticon talk this year: https://www.elastic.co/elasticon/conf/2017/sf/getting-your-data-graph-ready 3
关于 Elasticsearch 和 X-Pack : how to get vertices/connections from nested documents,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44434663/