邻接矩阵聚合

adjacency_matrix 聚合允许您定义过滤器表达式,并返回这些过滤器相交的矩阵,其中矩阵中的每个非空单元格代表一个桶。您可以找出任意过滤器组合内的文档数量。

使用 adjacency_matrix 聚合,通过将数据可视化为图形,可以发现概念之间的关联方式。

例如,在示例电子商务数据集中,分析不同制造公司之间的关联:

GET opensearch_dashboards_sample_data_ecommerce/_search
{
  "size": 0,
  "aggs": {
    "interactions": {
      "adjacency_matrix": {
        "filters": {
          "grpA": {
            "match": {
              "manufacturer.keyword": "Low Tide Media"
            }
          },
          "grpB": {
            "match": {
              "manufacturer.keyword": "Elitelligence"
            }
          },
          "grpC": {
            "match": {
              "manufacturer.keyword": "Oceanavigations"
            }
          }
        }
      }
    }
  }
}

示例响应

 {
   ...
   "aggregations" : {
     "interactions" : {
       "buckets" : [
         {
           "key" : "grpA",
           "doc_count" : 1553
         },
         {
           "key" : "grpA&grpB",
           "doc_count" : 590
         },
         {
           "key" : "grpA&grpC",
           "doc_count" : 329
         },
         {
           "key" : "grpB",
           "doc_count" : 1370
         },
         {
           "key" : "grpB&grpC",
           "doc_count" : 299
         },
         {
           "key" : "grpC",
           "doc_count" : 1218
         }
       ]
     }
   }
 }

让我们仔细查看这个结果:

 {
    "key" : "grpA&grpB",
    "doc_count" : 590
 }
  • grpA:由 Low Tide Media 制造的产品。

  • grpB:由 Elitelligence 制造的产品。

  • 590:由两家公司共同制造的产品数量。

您可以使用 UDB-SX Dashboards 通过网络图来呈现此数据。