栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如果ES中存在索引的索引,是否有基于API的方法在Kibana中创建索引模式

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如果ES中存在索引的索引,是否有基于API的方法在Kibana中创建索引模式

您可以做到,但是您需要自己构建整个结构。索引模式定义如下所示:

PUT .kibana/doc/index-pattern:<some-uuid>{      "type": "index-pattern",      "updated_at": "2018-01-27T07:12:05.373Z",      "index-pattern": {        "title": "test*",        "timeFieldName": "@timestamp",        "fields": """ ... """,      }}
  • title
    是索引模式的名称,如果通过UI创建索引模式,则输入的名称与您输入的名称相同
  • timeFieldName
    是时间戳字段的名称
  • fields
    是一个字符串,其中包含索引模式中所有字段定义的JSON数组(请参见下文)

字段定义如下所示:

[  {    "name": "@timestamp",    "type": "date",    "count": 0,    "scripted": false,    "searchable": true,    "aggregatable": true,    "readFromDocValues": true  },  {    "name": "_id",    "type": "string",    "count": 0,    "scripted": false,    "searchable": true,    "aggregatable": true,    "readFromDocValues": false  },  {    "name": "_index",    "type": "string",    "count": 0,    "scripted": false,    "searchable": true,    "aggregatable": true,    "readFromDocValues": false  },  {    "name": "_score",    "type": "number",    "count": 0,    "scripted": false,    "searchable": false,    "aggregatable": false,    "readFromDocValues": false  },  {    "name": "_source",    "type": "_source",    "count": 0,    "scripted": false,    "searchable": false,    "aggregatable": false,    "readFromDocValues": false  },  {    "name": "_type",    "type": "string",    "count": 0,    "scripted": false,    "searchable": true,    "aggregatable": true,    "readFromDocValues": false  },  {    "name": "referer",    "type": "string",    "count": 0,    "scripted": false,    "searchable": true,    "aggregatable": false,    "readFromDocValues": false  },  ...]

因此,您需要为每个字段创建此数组,然后对其进行字符串化并将字符串放入

fields
字段中。

这是代表索引模式的样本文档:

 {      "type": "index-pattern",      "updated_at": "2018-01-27T07:12:05.373Z",      "index-pattern": {        "title": "test*",        "timeFieldName": "@timestamp",        "fields": """[{"name":"@timestamp","type":"date","count":0,"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":true},{"name":"_id","type":"string","count":0,"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":false},{"name":"_index","type":"string","count":0,"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":false},{"name":"_score","type":"number","count":0,"scripted":false,"searchable":false,"aggregatable":false,"readFromDocValues":false},{"name":"_source","type":"_source","count":0,"scripted":false,"searchable":false,"aggregatable":false,"readFromDocValues":false},{"name":"_type","type":"string","count":0,"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":false},{"name":"referer","type":"string","count":0,"scripted":false,"searchable":true,"aggregatable":false,"readFromDocValues":false},{"name":"referer.keyword","type":"string","count":0,"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":true},{"name":"status","type":"number","count":0,"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":true},{"name":"url","type":"string","count":0,"scripted":false,"searchable":true,"aggregatable":false,"readFromDocValues":false},{"name":"url.keyword","type":"string","count":0,"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":true}]"""      }    }


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/383403.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号