Elasticsearch 和 X-Pack : how to get vertices/connections from nested documents

标签 elasticsearch graph network-analysis xpack elasticsearch-x-pack

我刚开始使用 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"
      }
    ]
  }
}

提前致谢!

最佳答案

这里讨论了以下问题: https://discuss.elastic.co/t/elasticsearch-x-pack-how-to-get-vertices-connections-from-nested-documents/88709

引自 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/

相关文章:

c# - 使用NEST API进行日期范围搜索以进行 Elasticsearch ,返回不适当的结果

powershell - powershell 中使用 MSCharting 的折线图

android - 如何在Android中查看网络数据包?

elasticsearch - 如何通过Edgengram匹配百分比对搜索结果进行排名

Elasticsearch - 将字段从 not_analyzed 更改为 analyzed

Elasticsearch 模糊短语

algorithm - 找到从 s 到每个 v 的最短路径,并限制长度

c++ - 在具有附加条件的图中找到最小加权路径

packet-sniffers - 为什么可以进行数据包嗅探?

r - R 基础对称矩阵中的图形可视化,其值为对角线