Elasticsearch学习笔记——索引模板

在索引模板里面,date类型的字段的format支持多种类型,在es中全部会转换成long类型进行存储,参考

https://zhuanlan.zhihu.com/p/34240906

一个索引模板范例

{
  "order": 0,
  "index_patterns": [
    "ssssssssssssssss_test*"
  ],
  "settings": {
    "index": {
      "codec": "best_compression",
      "routing": {
        "allocation": {
          "require": {
            "box_type": "master"
          },
          "total_shards_per_node": "3"
        }
      },
      "refresh_interval": "60s",
      "unassigned": {
        "node_left": {
          "delayed_timeout": "900m"
        }
      },
      "number_of_shards": "3",
      "number_of_replicas": "1"
    }
  },
  "mappings": {
    "_default_": {
      "_source": {
        "enabled": true
      },
      "dynamic_templates": [
        {
          "string_template": {
            "mapping": {
              "type": "keyword"
            },
            "match_mapping_type": "string",
            "match": "*"
          }
        }
      ],
      "properties": {
        "a1": {
          "search_analyzer": "ik_max_word",
          "analyzer": "ik_max_word",
          "type": "text"
        },
        "a2": {
          "type": "float"
        },
        "a3": {
          "type": "integer"
        },
        "untitled": {
          "type": "float"
        },
        "a4": {
          "type": "long"
        },
        "a5": {
          "type": "double"
        },
        "a6": {
          "type": "ip"
        },
        "a8": {
          "type": "keyword"
        }
      },
      "_all": {
        "enabled": false
      }
    }
  },
  "aliases": {}
}

 

posted @ 2019-10-29 11:36  tonglin0325  阅读(231)  评论(0编辑  收藏  举报