elasticsearch中的索引模板是怎樣的

elasticsearch中的索引模板是怎樣的,針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

站在用戶的角度思考問題,與客戶深入溝通,找到常熟網(wǎng)站設計與常熟網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗,讓設計與互聯(lián)網(wǎng)技術結合,創(chuàng)造個性化、用戶體驗好的作品,建站類型包括:成都做網(wǎng)站、網(wǎng)站建設、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣、申請域名網(wǎng)站空間、企業(yè)郵箱。業(yè)務覆蓋常熟地區(qū)。

索引模板簡介

索引模板是創(chuàng)建索引的一種方式。將數(shù)據(jù)寫入指定索引時,如果該索引不存在,則根據(jù)索引名稱能匹配相應索引模板話,會根據(jù)模板的配置建立索引。更多介紹請查看官網(wǎng)的Index templates

索引模板查看

查看某個索引模板

curl --user ${USERNAME}:${PASSWORD} -XGET "${ES_URL}/_template/ftp_download_log?pretty"

查看所有索引模板

curl --user ${USERNAME}:${PASSWORD} -XGET "${ES_URL}/_template?pretty"

索引模板創(chuàng)建

curl --user ${USERNAME}:${PASSWORD} -XPUT "${ES_URL}/_template/ftp_download_log" -H 'Content-Type: application/json' -d '
{
"index_patterns": ["ftp_download_log_*"],
"settings": {
    "index": {
      "number_of_shards": 12,
      "number_of_replicas": 0,
      "refresh_interval" : "30s"
    }
  },
  "mappings": {
    "properties": {
      "@timestamp": {
        "type": "date"
      },
      "ftpServerName": {
        "type": "keyword"
      },      
      "localPath": {
        "type": "keyword"
      },
      "logType": {
        "type": "keyword"
      },
      "remotePath": {
        "type": "keyword"
      },
      "srcFileSize": {
        "type": "long"
      },
      "srcFileTimestamp": {
        "type": "date"
      },
      "elapsedTime": {
        "type": "long"
      },
      "endTime": {
        "type": "date"
      },
      "startTime": {
        "type": "date"
      }
    }
   }
}'

索引模板刪除

curl --user ${USERNAME}:${PASSWORD} -XDELETE "${ES_URL}/_template/ftp_download_log"

索引模板修改

curl --user ${USERNAME}:${PASSWORD} -XPUT "${ES_URL}/_template/ftp_download_log" -H 'Content-Type: application/json' -d '
{
"index_patterns": ["ftp_download_log_*"],
"settings": {
    "index": {
      "number_of_shards": 12,
      "number_of_replicas": 0,
      "refresh_interval" : "30s"
    }
  },
  "mappings": {
    "properties": {
      "@timestamp": {
        "type": "date"
      },
      "fileDataTimeMillis": {
        "type": "date"
      },
      "ftpServerName": {
        "type": "keyword"
      }
    }
   }
}'

注意:文章中涉及命令是基于elasticsearch 7.1.1版本,與最新版本有較大不同。

關于elasticsearch中的索引模板是怎樣的問題的解答就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注創(chuàng)新互聯(lián)行業(yè)資訊頻道了解更多相關知識。

網(wǎng)頁題目:elasticsearch中的索引模板是怎樣的
分享URL:http://muchs.cn/article42/gdsjec.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版關鍵詞優(yōu)化、服務器托管、、網(wǎng)站維護Google

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設公司