elasticsearch笔记

357 阅读1分钟

一、index template 索引模板

查询

GET _template/audit_record?pretty

删除

DELETE _template/audit_record

设置

PUT _template/audit_record
{
    "order" : 0,
    "index_patterns" : [
      "audit_record*"
    ],
    "settings" : {
      "index" : {
        "codec" : "best_compression",
        "refresh_interval" : "1s",
        "number_of_shards" : "1",
        "number_of_replicas" : "1",
        "merge" : {
          "scheduler" : {
            "max_thread_count" : "1"
          }
        }
      }
    },
    "mappings" : {
      "audit_record" : {
        "properties" : {
          "createTime" : {
            "type" : "date"
          },
          "transactionId" : {
            "type" : "keyword"
          },
          "userId" : {
            "type" : "keyword"
          }
        }
      }
    },
    "aliases" : { }
}