修改es的模板数据结构

1.获取ES的模板(模板名称delta-alarm)

GET _template/delta-alarm

{
  "delta-alarm" : {
    "order" : 0,
    "index_patterns" : [
      "delta-alarm*"
    ],
    "settings" : {
      "index" : {
        "number_of_shards" : "20",
        "number_of_replicas" : "1"
      }
    },
    "mappings" : {
      "properties" : {
        "alarmContent" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "ignore_above" : 256,
              "type" : "keyword"
            }
          }
        },
        "notifyMethod" : {
          "type" : "keyword"
        },
        "resourceId" : {
          "type" : "keyword"
        },
        "role" : {
          "type" : "keyword"
        },
        "appEnName" : {
          "type" : "keyword"
        },
        "startWindow" : {
          "type" : "date"
        },
        "endWindow" : {
          "type" : "date"
        },
        "threshold" : {
          "type" : "float"
        },
        "ruleKey" : {
          "type" : "keyword"
        },
        "processTime" : {
          "type" : "date"
        },
        "endpoint" : {
          "type" : "keyword"
        },
        "receivers" : {
          "type" : "keyword"
        },
        "ruleGroupKey" : {
          "type" : "keyword"
        },
        "id" : {
          "type" : "keyword"
        },
        "value" : {
          "type" : "float"
        },
        "isSuccess" : {
          "type" : "boolean"
        },
        "timestamp" : {
          "type" : "date"
        },
        "runAt" : {
          "type" : "long"
        },
        "level" : {
          "type" : "keyword"
        },
        "notifyTime" : {
          "type" : "date"
        },
        "appOwner" : {
          "type" : "keyword"
        },
        "messageId" : {
          "type" : "keyword"
        },
        "begin_time" : {
          "type" : "date"
        },
        "saving_time" : {
          "type" : "date"
        },
        "smartlog_ip" : {
          "type" : "keyword"
        },
        "labels" : {
          "type" : "keyword"
        },
        "metric" : {
          "type" : "keyword"
        },
        "notifyEnable" : {
          "type" : "boolean"
        },
        "originalData" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "ignore_above" : 256,
              "type" : "keyword"
            }
          }
        },
        "resourceType" : {
          "type" : "keyword"
        }
      }
    },
    "aliases" : { }
  }
}

2.修改ES的模板

POST _template/delta-alarm

{
    "order" : 0,
    "index_patterns" : [
      "delta-alarm*"
    ],
    "settings" : {
      "index" : {
        "number_of_shards" : "20",
        "number_of_replicas" : "1"
      }
    },
    "mappings" : {
      "properties" : {
        "alarmContent" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "ignore_above" : 256,
              "type" : "keyword"
            }
          }
        },
        "notifyMethod" : {
          "type" : "keyword"
        },
        "resourceId" : {
          "type" : "keyword"
        },
        "role" : {
          "type" : "keyword"
        },
        "appEnName" : {
          "type" : "keyword"
        },
        "startWindow" : {
          "type" : "date"
        },
        "endWindow" : {
          "type" : "date"
        },
        "threshold" : {
          "type" : "float"
        },
        "ruleKey" : {
          "type" : "keyword"
        },
        "processTime" : {
          "type" : "date"
        },
        "endpoint" : {
          "type" : "keyword"
        },
        "receivers" : {
          "type" : "keyword"
        },
        "ruleGroupKey" : {
          "type" : "keyword"
        },
        "id" : {
          "type" : "keyword"
        },
        "value" : {
          "type" : "float"
        },
        "isSuccess" : {
          "type" : "boolean"
        },
        "timestamp" : {
          "type" : "date"
        },
        "runAt" : {
          "type" : "long"
        },
        "level" : {
          "type" : "keyword"
        },
        "notifyTime" : {
          "type" : "date"
        },
        "appOwner" : {
          "type" : "keyword"
        },
        "messageId" : {
          "type" : "keyword"
        },
        "begin_time" : {
          "type" : "date"
        },
        "saving_time" : {
          "type" : "date"
        },
        "smartlog_ip" : {
          "type" : "keyword"
        },
        "labels" : {
          "type" : "keyword"
        },
        "metric" : {
          "type" : "keyword"
        },
        "notifyEnable" : {
          "type" : "boolean"
        },
        "originalData" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "ignore_above" : 256,
              "type" : "keyword"
            }
          }
        },
        "resourceType" : {
          "type" : "keyword"
        }
      }
    },
    "aliases" : { }
  }
posted @ 2023-02-27 16:21  SpecialSpeculator  阅读(481)  评论(0编辑  收藏  举报