ES7.15.1 索引模板

635 阅读1分钟
{
  "index_patterns": [
    "*"
  ],
  "priority": 1,
  "settings": {
      "index": {
        "refresh_interval": "5s",
        "number_of_shards": "1",
        "max_result_window": 10000,
        "translog": {
          "flush_threshold_size": "500mb",
          "sync_interval": "30s",
          "durability": "async"
        },
        "merge": {
          "scheduler": {
            "max_merge_count": "100",
            "max_thread_count": "1"
          }
        },
        "analysis": {
          "analyzer": {
            "hanlp_array": {
              "type": "pattern",
              "pattern": "[,;。??!!,、;::“”‘’《》【】()~〈〉「」『』…/\\[\\]<>\"\\`\\^*+]+",
              "lowercase": "true"
            }
          }
        },
        "number_of_replicas": "0",
        "unassigned": {
          "node_left": {
            "delayed_timeout": "2m"
          }
        }
      }
    },
    "mappings": {
      "dynamic_date_formats": [
        "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||yyyy-MM||yyyy/MM/dd||yyyy/MM||strict_date_optional_time||epoch_millis"
      ],
      "properties": {
        "html": {
          "index": "false",
          "doc_values": "false",
          "norms": "false",
          "fielddata": "false",
          "store": "false",
          "type": "text"
        }
      },
      "dynamic_templates": [
        {
          "id_field": {
            "mapping": {
              "type": "keyword",
              "store": "true"
            },
            "match": "*id"
          }
        },
        {
          "no_field": {
            "mapping": {
              "type": "keyword",
              "store": "true"
            },
            "match": "*no"
          }
        },
        {
          "code_field": {
            "mapping": {
              "type": "keyword",
              "store": "true"
            },
            "match": "*code"
          }
        },
        {
          "geo_field": {
            "mapping": {
              "type": "geo_point",
              "store": "true"
            },
            "match": "*_geo"
          }
        },
        {
          "ip_field": {
            "mapping": {
              "type": "ip",
              "store": "true"
            },
            "match": "*_ip"
          }
        },
        {
          "len_field": {
            "mapping": {
              "type": "integer",
              "store": "true"
            },
            "match": "*_len"
          }
        },
        {
          "num_field": {
            "mapping": {
              "type": "integer",
              "store": "true"
            },
            "match": "*_num"
          }
        },
        {
          "long_field": {
            "mapping": {
              "type": "long",
              "store": "true"
            },
            "match": "*_long"
          }
        },
        {
          "ft_field": {
            "mapping": {
              "type": "float",
              "store": "true"
            },
            "match": "*_ft"
          }
        },
        {
          "db_field": {
            "mapping": {
              "type": "double",
              "store": "true"
            },
            "match": "*_db"
          }
        },
        {
          "typ_field": {
            "mapping": {
              "type": "keyword",
              "store": "true"
            },
            "match": "*_typ*"
          }
        },
        {
          "sta_field": {
            "mapping": {
              "type": "keyword",
              "store": "true"
            },
            "match": "*_sta"
          }
        },
        {
          "lvl_field": {
            "mapping": {
              "type": "keyword",
              "store": "true"
            },
            "match": "*_lvl"
          }
        },
        {
          "flg_field": {
            "mapping": {
              "type": "keyword",
              "store": "true"
            },
            "match": "*_flg"
          }
        },
        {
          "dtm_field": {
            "mapping": {
              "type": "date",
              "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||yyyy-MM||yyyy||yyyy/MM/dd||yyyy/MM||strict_date_optional_time||epoch_millis",
              "store": "true"
            },
            "match": "*_dtm"
          }
        },
        {
          "ns_field": {
            "mapping": {
              "index": "false",
              "doc_values": "false",
              "norms": "false",
              "fielddata": "false",
              "store": "false"
            },
            "match": "*_ns"
          }
        },
        {
          "bin_field": {
            "mapping": {
              "type": "binary",
              "doc_values": "false",
              "norms": "false",
              "fielddata": "false",
              "store": "false"
            },
            "match": "*_bin"
          }
        },
        {
          "raw_field": {
            "mapping": {
              "type": "binary",
              "doc_values": "false",
              "norms": "false",
              "fielddata": "false",
              "store": "false"
            },
            "match": "*_raw"
          }
        },
        {
          "std_field": {
            "mapping": {
              "store": "true",
              "analyzer": "standard",
              "type": "text"
            },
            "match": "*_std"
          }
        },
        {
          "url_field": {
            "mapping": {
              "store": "true",
              "type": "keyword",
              "doc_values": "false",
              "norms": "false",
              "fielddata": "false"
            },
            "match": "*_url"
          }
        },
        {
          "tag_field": {
            "mapping": {
              "store": "true",
              "type": "text",
              "analyzer": "ik_max_word",
              "search_analyzer": "ik_max_word",
              "search_quote_analyzer": "ik_max_word",
              "fields": {
                "orginal": {
                  "type": "keyword"
                },
                "array": {
                  "analyzer": "hanlp_array",
                  "search_analyzer": "ik_max_word",
                  "type": "text",
                  "fielddata": "true"
                }
              }
            },
            "match": "*tag"
          }
        },
        {
          "file_field": {
            "mapping": {
              "type": "attachment",
              "fields": {
                "content": {
                  "store": "false",
                  "type": "text"
                },
                "author": {
                  "store": "true",
                  "type": "text"
                },
                "title": {
                  "store": "true",
                  "type": "text"
                },
                "keywords": {
                  "store": "true",
                  "type": "text"
                },
                "content_length": {
                  "store": "true"
                },
                "language": {
                  "store": "true"
                },
                "date": {
                  "store": "true",
                  "type": "date"
                },
                "content_type": {
                  "store": "true"
                }
              }
            },
            "match": "*_file"
          }
        },
        {
          "path_field": {
            "mapping": {
              "store": "true",
              "analyzer": "hanlp_array",
              "search_analyzer": "ik_max_word",
              "type": "text",
              "fielddata": "true",
              "fields": {
                "normal": {
                  "type": "text",
                  "analyzer": "ik_max_word",
                  "search_analyzer": "ik_max_word",
                  "search_quote_analyzer": "ik_max_word"
                },
                "orginal": {
                  "type": "keyword"
                }
              }
            },
            "match": "*_path"
          }
        },
        {
          "arr_field": {
            "mapping": {
              "store": "true",
              "analyzer": "hanlp_array",
              "search_analyzer": "ik_max_word",
              "type": "text",
              "fielddata": "true",
              "fields": {
                "normal": {
                  "type": "text",
                  "analyzer": "ik_max_word",
                  "search_analyzer": "ik_max_word",
                  "search_quote_analyzer": "ik_max_word"
                }
              }
            },
            "match": "*_arr"
          }
        },
        {
          "string_field": {
            "mapping": {
              "type": "text",
              "analyzer": "ik_max_word",
              "search_analyzer": "ik_max_word",
              "search_quote_analyzer": "ik_max_word",
              "term_vector": "with_positions_offsets",
              "fields": {
                "orginal": {
                  "type": "keyword",
                  "ignore_above": "36"
                }
              }
            },
            "match_mapping_type": "string"
          }
        }
      ]
    }
}