adolfjap

elasticsearch

icPUT _template/ik_field_template  //创建名为global_template的模板

{

  "template":   "*", 

  "settings": { "number_of_shards": 3 }, 

  "mappings": {

    "_default_": {

      "_all": { 

        "enabled": false //关闭所有类型的_all字段

      },

      "dynamic_templates": [

        {

          "string_as_text": { 

            "match_mapping_type": "string", //数据类型

            "match":   "*_ik_text", //以_ik_text为后缀的字段

            "mapping": {

              "type": "text",

              "analyzer": "ik_max_word",

              "search_analyzer": "ik_max_word",

              "fields": {

                "raw": {

                  "type":  "keyword",

                  "ignore_above": 256

                }

              }

            }

          }

        }

      ]

    }

  }}


评论