Elasticsearch Templates 是一种简化索引模板创建和管理的方法。以下是一些常用的模板示例。

常用模板

模板示例1

{
  "index_patterns": ["<index_pattern>"],
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0
  },
  "mappings": {
    "properties": {
      "timestamp": {
        "type": "date",
        "format": "strict_date_optional_time||epoch_millis"
      },
      "message": {
        "type": "text"
      }
    }
  }
}

模板示例2

{
  "index_patterns": ["<index_pattern>"],
  "settings": {
    "analysis": {
      "analyzer": {
        "my_custom_analyzer": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": ["lowercase", "stop"]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "title": {
        "type": "text",
        "analyzer": "my_custom_analyzer"
      }
    }
  }
}

更多信息

要了解更多关于 Elasticsearch Templates 的信息,请访问官方文档


图片:

Elasticsearch_Templates