繁体   English   中英

从ElasticSearch在Kibana中显示不同的文档类型

[英]Showing Different Document Types in Kibana from ElasticSearch

我正在尝试设置Kibana仪表板。 此仪表板正在访问ElasticSearch索引。 我的索引具有以下映射:

"myindex": {
  "mappings": {
    "animals": {
      "properties": {
        "@timestamp": {
          "type": "date",
          "format": "dateOptionalTime"
        },
        "@version": {
          "type": "string"
        },
        "Class": {
          "type": "string"
        },
        "Order": {
          "type": "string"
        },
        "Family": {
          "type": "string"
        },
        "Genus": {
          "type": "string"
        },
        "Species": {
          "type": "string"
        }
      }
    },
    "elements" : {
      "properties": {
        "@timestamp": {
          "type": "date",
          "format": "dateOptionalTime"
        },
        "@version": {
          "type": "string"
        },
        "Symbol": {
          "type": "string"
        },
        "Name": {
          "type": "string"
        },
        "Group": {
          "type": "string"
        },
        "Period": {
          "type": "string"
        }             
      }
    }
  }
}

正如映射所示,我的索引有两种不同类型的信息。 我的挑战是,我不知道如何设置我的kibana仪表板只列出每种类型的信息。 我已经确认我的elasticsearch实例中的数据是正确的数据。

在我的仪表板中,我试图显示两个表格。 一个表格将显示与“动物”相关的所有文件。 另一个表将显示与“元素”相关的所有文档。 不幸的是,我无法弄清楚如何将表格的结果集中到特定类型。 我基本上试图弄清楚如何为特定面板设置查询或过滤器(不确定kibana世界中两者之间的差异)。 目前,我的仪表板如下所示:

{
  "title": "Research",
  "services": {
    "query": {
      "list": {
        "0": {
          "query": "*",
          "alias": "",
          "color": "#7EB26D",
          "id": 0,
          "pin": false,
          "type": "lucene"
        }
      },
      "ids": [
        0
      ]
    },
    "filter": {
      "list": {
        "0": {
          "type": "time",
          "field": "@timestamp",
          "from": "now-{{ARGS.from || '24h'}}",
          "to": "now",
          "mandate": "must",
          "active": true,
          "alias": "",
          "id": 0
        }
      },
      "ids": [
        0
      ]
    }
  },
  "rows": [
    {
      "title": "Animals",
      "height": "350px",
      "editable": true,
      "collapse": false,
      "collapsable": true,
      "panels": [
        {
          "title": "Animals",
          "error": false,
          "span": 12,
          "editable": true,
          "group": [
            "default"
          ],
          "type": "table",
          "size": 100,
          "pages": 5,
          "offset": 0,
          "sort": [
            "@timestamp",
            "desc"
          ],
          "style": {
            "font-size": "9pt"
          },
          "overflow": "min-height",
          "fields": [
            "Class",
            "Order",
            "Family",
            "Genus",
            "Species"
          ],
          "localTime": true,
          "timeField": "@timestamp",
          "highlight": [],
          "sortable": true,
          "header": true,
          "paging": true,
          "spyable": true,
          "queries": {
            "mode": "all",
            "ids": [
              0
            ]
          },
          "field_list": true,
          "status": "Stable",
          "trimFactor": 300,
          "normTimes": true
        }
      ],
      "notice": false
    },
    {
      "title": "",
      "height": "350px",
      "editable": true,
      "collapse": false,
      "collapsable": true,
      "panels": [
        {
          "title": "Elements",
          "error": false,
          "span": 12,
          "editable": true,
          "group": [
            "default"
          ],
          "type": "table",
          "size": 100,
          "pages": 5,
          "offset": 0,
          "sort": [
            "@timestamp",
            "desc"
          ],
          "style": {
            "font-size": "9pt"
          },
          "overflow": "min-height",
          "fields": [
            "Symbol",
            "Name",
            "Group",
            "Period"
          ],
          "localTime": true,
          "timeField": "@timestamp",
          "highlight": [],
          "sortable": true,
          "header": true,
          "paging": true,
          "spyable": true,
          "queries": {
            "mode": "all",
            "ids": [
              0
            ]
          },
          "field_list": true,
          "trimFactor": 300,
          "normTimes": true
        }
      ],
      "notice": false
    }    
  ],
  "editable": true,
  "failover": false,
  "index": {
    "interval": "none",
    "default": "myindex"
  },
  "style": "dark",
  "panel_hints": true,
  "pulldowns": [
    {
      "type": "query",
      "collapse": false,
      "notice": false,
      "query": "*",
      "pinned": true,
      "history": [],
      "remember": 10
    },
    {
      "type": "filtering",
      "collapse": true,
      "notice": false
    }
  ],
  "loader": {
    "save_gist": false,
    "save_elasticsearch": true,
    "save_local": true,
    "save_default": true,
    "save_temp": true,
    "save_temp_ttl_enable": true,
    "save_temp_ttl": "30d",
    "load_gist": true,
    "load_elasticsearch": true,
    "load_elasticsearch_size": 20,
    "load_local": true,
    "hide": false
  },
  "refresh": "30s"
}

有人能告诉我如何在Kibana中显示两种不同类型的文件吗? 我在表格面板上看到了一个查询对象。 但是,我不知道如何使用它。

非常感谢

您可以使用_type字段将结果缩小到特定的弹性搜索类型(例如动物)。

因此,当您为表定义查询(或过滤器)时,只需确保指定相关的_type (即_type: animals

您可以使用脚本字段将type的值作为将被索引的单独字段。

或者您可以将_type字段添加到搜索字段,它将可用。

如果是脚本化字段,请添加为doc['_type'].value并为其指定任何名称。

https://github.com/elastic/kibana/issues/5684

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM