在kibana面板中使用嵌套字段

Kev*_*vin 7 elasticsearch kibana

我试图显示一个Kibana仪表板,它运作良好.不幸的是,当我想添加一个包含公司位置国家的饼图(或其他表示)时,我有一个空面板.

我可以使用kibana查询来过滤特定国家/地区,但我无法显示带有嵌套文档的面板.

我的映射(我必须使用嵌套字段,因为公司可以有多个位置):

{
  "settings" : {
    "number_of_shards" : 1
  },
  "mappings": {
    "company" : {
      "properties" : {
        "name" : { "type" : "string", "store" : "yes" },
        "website" : { "type" : "string", "store" : "yes" },
        "employees" : { "type" : "string", "store" : "yes" },
        "type": { "type" : "string", "store" : "yes" },
        "locations" : {
          "type" : "nested",
          "properties" : {
            "city" : { "type" : "string", "store" : "yes" },
            "country" : { "type" : "string", "store" : "yes" },
            "coordinates" : { "type" : "geo_point", "store" : "yes" }
          }
        }
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

你知道我怎么能用嵌套对象显示面板?它实施了吗?

谢谢,凯文

小智 0

您的映射中缺少一个参数 ("include_in_parent": true)。正确的映射应该是:

{
  "settings" : {
    "number_of_shards" : 1
  },
  "mappings": {
    "company" : {
      "properties" : {
        "name" : { "type" : "string", "store" : "yes" },
        "website" : { "type" : "string", "store" : "yes" },
        "employees" : { "type" : "string", "store" : "yes" },
        "type": { "type" : "string", "store" : "yes" },
        "locations" : {
          "type" : "nested",
          "include_in_parent": true,
          "properties" : {
            "city" : { "type" : "string", "store" : "yes" },
            "country" : { "type" : "string", "store" : "yes" },
            "coordinates" : { "type" : "geo_point", "store" : "yes" }
          }
        }
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)