【问题标题】:Elasticsearch & X-Pack: how to get vertices/connections from nested documentsElasticsearch & X-Pack:如何从嵌套文档中获取顶点/连接
【发布时间】:2017-06-08 11:37:24
【问题描述】:

我刚开始使用 X-Pack for Elasticsearch 并希望连接来自嵌套文档类型的顶点。然而,寻找这方面的文档并没有让我有任何收获。

我拥有的是一个文档索引,其中包含人名/ID 作为嵌套文档(一个文档可以有很多人,一个人可以与多个文档相关)。期望的结果是得到一个人之间有联系的图数据。

有没有人有线索或者可以告诉我这是否可能?

我的部分映射:

mappings: {
    legend: {
        properties: {
            persons: {
                type: 'nested',
                properties: {
                    id: {
                        type: 'string',
                        index: 'not_analyzed'
                    },
                    name: {
                        type: 'string',
                        index: 'not_analyzed'
                    }
                }
            }
        }
    }
}

还有我的 Graph API 查询,这当然不起作用,因为我不知道如何处理嵌套的“persons”字段的“name”字段。

POST sagenkarta_v3/_xpack/_graph/_explore
{
  "controls": {
    "use_significance": true,
    "sample_size": 20000,
    "timeout": 2000
  },
  "vertices": [
    {
      "field": "persons.name"
    }
  ],
  "connections": {
    "vertices": [
      {
        "field": "persons.name"
      }
    ]
  }
}

提前致谢!

【问题讨论】:

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


    【解决方案1】:

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

    引自 Mark_Harwood - Elastic 团队成员:

    不幸的是 Graph 不支持嵌套文档,但您可以使用 copy_to 在您的映射中将人员数据放在索引字段中 包含根文档。

    我可以看到你有一个经典的问题 “computers-want-IDs-but-people-want-labels”并拥有这两个 价值观。在 Graph 中(也可以说是 Kibana 的其余部分)我建议你 为了唯一性,使用结合了 ID 和名称的标记 人类可读性。

    copy_to 和 IDs-and-labels 提示是建模的一部分 今年我的弹性演讲中的建议: https://www.elastic.co/elasticon/conf/2017/sf/getting-your-data-graph-ready 3

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-21
      相关资源
      最近更新 更多