0

基于https://github.com/vanthome/winston-elasticsearch/blob/master/index-template-mapping.json制作模板

 {
      "index_patterns": ["applogs-*"],
      "settings": {
        "number_of_shards": 1

      },
      "mappings": {
        "_source": { "enabled": true },
        "properties": {
          "@timestamp": { "type": "date" },
          "@version": { "type": "keyword" },
          "message": { "type": "text", "index": true },
          "severity": { "type": "keyword", "index": true },
          "geohash":{ "type": "geo-point", "index": true},
          "location":{ "type": "geo-point", "index": true},
        }
      }
    }

但得到一个错误

[mapper_parsing_exception] Root mapping definition has unsupported parameters:  [severity : {index=true, type=keyword}] [@timestamp : {type=date}] [@version : {type=keyword}] [message : {index=true, type=text}] [fields : {dynamic=true, properties={}}]

可能是一些过时的版本?我应该更新什么?

4

1 回答 1

0

基于文档

PUT _template/template_1
{
  "index_patterns": [
    "applogs-*"
  ],
  "settings": {
    "number_of_shards": 1
  },
  "mappings": {
    "_source": {
      "enabled": true
    },
    "properties": {
      "@timestamp": {
        "type": "date"
      },
      "@version": {
        "type": "keyword"
      },
      "message": {
        "type": "text",
        "index": true
      },
      "severity": {
        "type": "keyword",
        "index": true
      },
      "geohash": {
        "type": "geo_point",
        "index": true
      },
      "location": {
        "type": "geo_point",
        "index": true
      }
    }
  }
}

您的 json 无效(一个逗号太多)而且geo-point--> geo_point

于 2020-03-25T15:08:00.250 回答