Elasticsearch 创建默认模板,以后再也不需要再重新建索引了

curl -XPUT 'http://192.168.1.181:9200/_template/template_t_url' -d ' {
 "template": "t_url-*",
  "settings": {
    "index": {
      "number_of_shards": 3,
      "number_of_replicas": 1
    }
  },
  "mappings": {
    "info": {
      "properties": {
        "referer": {
          "type": "string",
          "index": "not_analyzed"
        },
        "descid": {
          "type": "integer",
          "index": "not_analyzed"
        },
        "line": {
          "type": "string",
          "index": "not_analyzed"
        },
        "words": {
          "type": "string",
          "index": "not_analyzed"
        },
        "dip": {
          "type": "ip",
          "index": "not_analyzed"
        },
        "starttime": {
          "type": "date",
          "format": "yyy-MM-dd HH:mm:ss"
        },

        "dir": {
          "type": "integer",
          "index": "not_analyzed"
        },
        "rid": {
          "type": "string",
          "index": "not_analyzed"
        },
        "type": {
          "type": "integer",
          "index": "not_analyzed"
        },
        "grpids": {
          "type": "integer",
          "index": "not_analyzed"
        },
        "platform": {
          "type": "string",
          "index": "not_analyzed"
        },
        "url": {
          "type": "string",
          "index": "not_analyzed"
        },
        "dport": {
          "type": "integer",
          "index": "not_analyzed"
        },
        "subtype": {
          "type": "integer",
          "index": "not_analyzed"
        },
        "bytes": {
          "type": "integer",
          "index": "not_analyzed"
        },
        "browser": {
          "type": "string",
          "index": "not_analyzed"
        },
        "domain": {
          "type": "string",
          "index": "not_analyzed"
        },
        "action": {
          "type": "string",
          "index": "not_analyzed"
        },
        "termtype": {
          "type": "string",
          "index": "not_analyzed"
        },
        "sip": {
          "type": "ip",
          "index": "not_analyzed"
        },
        "sport": {
          "type": "integer",
          "index": "not_analyzed"
        },
        "username": {
          "type": "string",
          "index": "not_analyzed"
        }
      }
    }
  }
}'

你可能感兴趣的:(elasticsearch)