最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

es創(chuàng)建索引和mapping的實(shí)例

 更新時(shí)間:2023年02月25日 16:55:16   作者:goxingman  
這篇文章主要介紹了es創(chuàng)建索引和mapping的實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

es創(chuàng)建索引和mapping

索引和type分開創(chuàng)建

1、創(chuàng)建index

http://127.0.0.1:9200/
negative/ ? ?put
{
? "settings": {
? ? "index": {
? ? ? "search": {
? ? ? ? "slowlog": {
? ? ? ? ? "threshold": {
? ? ? ? ? ? "fetch": {
? ? ? ? ? ? ? "debug": "5s"
? ? ? ? ? ? },
? ? ? ? ? ? "query": {
? ? ? ? ? ? ? "warn": "20s"
? ? ? ? ? ? }
? ? ? ? ? }
? ? ? ? }
? ? ? },
? ? ? "indexing": {
? ? ? ? "slowlog": {
? ? ? ? ? "threshold": {
? ? ? ? ? ? "index": {
? ? ? ? ? ? ? "info": "20s"
? ? ? ? ? ? }
? ? ? ? ? }
? ? ? ? }
? ? ? },
? ? ? "number_of_shards": "1",
? ? ? "number_of_replicas": "0"
? ? }
? }
}

2、創(chuàng)建mapping

http://127.0.0.1:9200/
negative/negative/_mapping ?post
{"properties":{
? "id": {
? ? "type": "long"
? },
? "yjlb": {
? ? "type": "text",
? ? "fields": {
? ? ? "keyword": {
? ? ? ? "type": "keyword",
? ? ? ? "ignore_above": 256
? ? ? }
? ? }
? },
? "ejlb": {
? ? "type": "text",
? ? "fields": {
? ? ? "keyword": {
? ? ? ? "type": "keyword",
? ? ? ? "ignore_above": 256
? ? ? }
? ? }
? },
? "sjlb": {
? ? "type": "text",
? ? "fields": {
? ? ? "keyword": {
? ? ? ? "type": "keyword",
? ? ? ? "ignore_above": 256
? ? ? }
? ? }
? },
? "detail": {
? ? "type": "text",
? ? "fields": {
? ? ? "keyword": {
? ? ? ? "type": "keyword",
? ? ? ? "ignore_above": 256
? ? ? }
? ? }
? },
? "ssyj": {
? ? "type": "text",
? ? "fields": {
? ? ? "keyword": {
? ? ? ? "type": "keyword",
? ? ? ? "ignore_above": 256
? ? ? }
? ? }
? }
}}

索引和type一次創(chuàng)建

(注意:mapping下面一層的key值 是type名稱)

http://192.168.0.213:9200/
announcement/ ? ?put
{
? "settings": {
? ? "index": {
? ? ? "search": {
? ? ? ? "slowlog": {
? ? ? ? ? "threshold": {
? ? ? ? ? ? "fetch": {
? ? ? ? ? ? ? "debug": "5s"
? ? ? ? ? ? },
? ? ? ? ? ? "query": {
? ? ? ? ? ? ? "warn": "20s"
? ? ? ? ? ? }
? ? ? ? ? }
? ? ? ? }
? ? ? },
? ? ? "indexing": {
? ? ? ? "slowlog": {
? ? ? ? ? "threshold": {
? ? ? ? ? ? "index": {
? ? ? ? ? ? ? "info": "20s"
? ? ? ? ? ? }
? ? ? ? ? }
? ? ? ? }
? ? ? },
? ? ? "number_of_shards": "1",
? ? ? "number_of_replicas": "0"
? ? }
? },
? "mappings": {
? ? "announcement": {
? ? ? "properties": {
? ? ? ? "id": {
? ? ? ? ? "type": "keyword"
? ? ? ? },
? ? ? ? "createtime": {
? ? ? ? ? "type": "date",
? ? ? ? ? "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
? ? ? ? },
? ? ? ? "creatby": {
? ? ? ? ? "type": "keyword"
? ? ? ? },
? ? ? ? "updatetime": {
? ? ? ? ? "type": "date",
? ? ? ? ? "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
? ? ? ? },
? ? ? ? "type": {
? ? ? ? ? "type": "keyword"
? ? ? ? },
? ? ? ? "status": {
? ? ? ? ? "type": "keyword"
? ? ? ? },
? ? ? ? "title": {
? ? ? ? ? "type": "text",
? ? ? ? ? "fields": {
? ? ? ? ? ? "keyword": {
? ? ? ? ? ? ? "type": "keyword",
? ? ? ? ? ? ? "ignore_above": 256
? ? ? ? ? ? }
? ? ? ? ? }
? ? ? ? },
? ? ? ? "cont": {
? ? ? ? ? "type": "text",
? ? ? ? ? "fields": {
? ? ? ? ? ? "keyword": {
? ? ? ? ? ? ? "type": "keyword",
? ? ? ? ? ? ? "ignore_above": 256
? ? ? ? ? ? }
? ? ? ? ? }
? ? ? ? },
? ? ? ? "files": {
? ? ? ? ? "type": "nested",
? ? ? ? ? "properties": {
? ? ? ? ? ? "id": {
? ? ? ? ? ? ? "type": "keyword"
? ? ? ? ? ? },
? ? ? ? ? ? "filename": {
? ? ? ? ? ? ? "type": "text",
? ? ? ? ? ? ? "fields": {
? ? ? ? ? ? ? ? "keyword": {
? ? ? ? ? ? ? ? ? "type": "keyword",
? ? ? ? ? ? ? ? ? "ignore_above": 256
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? }
? ? ? ? }
? ? ? }
? ? }
? }
}

更改elasticsearch中索引的mapping

昨天研發(fā)說在kibana中統(tǒng)計(jì)userid字段不出圖,后來查到該字段顯示沖突了,然后再查看了GET test/_mapping下該索引的mapping,發(fā)現(xiàn)userid是long類型的,而userid.keyword是string類型的,出現(xiàn)這種情況的根本原因是日志中這個(gè)字段存的是數(shù)值類型的值,改成字符串類型即可,由于急著用,我司上線一般是下午6點(diǎn)30上線,所以臨時(shí)修改了下該字段的類型,步驟如下:

查看舊索引的mapping

  • GET test/_mapping 

找到userid這個(gè)字段,修改類型為keyword,如下:

{
?? ?"mappings": {
?? ??? ?"doc": {
?? ??? ??? ?"properties": {
?? ??? ??? ??? ?"@timestamp": {
?? ??? ??? ??? ??? ?"type": "date"
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"@version": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"beat": {
?? ??? ??? ??? ??? ?"properties": {
?? ??? ??? ??? ??? ??? ?"hostname": {
?? ??? ??? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?},
?? ??? ??? ??? ??? ??? ?"name": {
?? ??? ??? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?},
?? ??? ??? ??? ??? ??? ?"version": {
?? ??? ??? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"code": {
?? ??? ??? ??? ??? ?"type": "long"
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"dip": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ?"properties": {
?? ??? ??? ??? ??? ??? ?"log_topic": {
?? ??? ??? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"host": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"message": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"method": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"name": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"offset": {
?? ??? ??? ??? ??? ?"type": "long"
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"referer": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"sip": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"source": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"tags": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"time": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"url": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"userid": {
?? ??? ??? ??? ??? ?"type": "keyword" ? #修改此處
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ?}
?? ?}
}

創(chuàng)建一個(gè)自定義mapping的新索引

PUT test-new
{
?? ?"mappings": {
?? ??? ?"doc": {
?? ??? ??? ?"properties": {
?? ??? ??? ??? ?"@timestamp": {
?? ??? ??? ??? ??? ?"type": "date"
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"@version": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"beat": {
?? ??? ??? ??? ??? ?"properties": {
?? ??? ??? ??? ??? ??? ?"hostname": {
?? ??? ??? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?},
?? ??? ??? ??? ??? ??? ?"name": {
?? ??? ??? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?},
?? ??? ??? ??? ??? ??? ?"version": {
?? ??? ??? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"code": {
?? ??? ??? ??? ??? ?"type": "long"
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"dip": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ?"properties": {
?? ??? ??? ??? ??? ??? ?"log_topic": {
?? ??? ??? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"host": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"message": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"method": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"name": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"offset": {
?? ??? ??? ??? ??? ?"type": "long"
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"referer": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"sip": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"source": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"tags": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"time": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"url": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"userid": {
?? ??? ??? ??? ??? ?"type": "keyword"
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ?}
?? ?}
}

把舊索引的數(shù)據(jù)reindex到新索引上

注意,舊索引先停止新數(shù)據(jù)的寫入

POST _reindex
{
? "source": {
? ? "index": "test"
? },
? "dest": {
? ? "index": "test-new"
? }
}

刪除舊索引

DELETE test

按照步驟2創(chuàng)建test索引

PUT test
{
?? ?"mappings": {
?? ??? ?"doc": {
?? ??? ??? ?"properties": {
?? ??? ??? ??? ?"@timestamp": {
?? ??? ??? ??? ??? ?"type": "date"
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"@version": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"beat": {
?? ??? ??? ??? ??? ?"properties": {
?? ??? ??? ??? ??? ??? ?"hostname": {
?? ??? ??? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?},
?? ??? ??? ??? ??? ??? ?"name": {
?? ??? ??? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?},
?? ??? ??? ??? ??? ??? ?"version": {
?? ??? ??? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"code": {
?? ??? ??? ??? ??? ?"type": "long"
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"dip": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ?"properties": {
?? ??? ??? ??? ??? ??? ?"log_topic": {
?? ??? ??? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"host": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"message": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"method": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"name": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"offset": {
?? ??? ??? ??? ??? ?"type": "long"
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"referer": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"sip": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"source": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"tags": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"time": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"url": {
?? ??? ??? ??? ??? ?"type": "text",
?? ??? ??? ??? ??? ?"fields": {
?? ??? ??? ??? ??? ??? ?"keyword": {
?? ??? ??? ??? ??? ??? ??? ?"type": "keyword",
?? ??? ??? ??? ??? ??? ??? ?"ignore_above": 256
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?},
?? ??? ??? ??? ?"userid": {
?? ??? ??? ??? ??? ?"type": "keyword"
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ?}
?? ?}
}

把test-new索引的數(shù)據(jù)reindex到test索引上

POST _reindex
{
? "source": {
? ? "index": "test-new"
? },
? "dest": {
? ? "index": "test"
? }
}

查看test索引的mapping

GET test/_mapping,執(zhí)行命令后,可以看到userid的字段類型為keyword類型了

然后再打開該索引接收新數(shù)據(jù)的開關(guān)

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Spring Security的持久化用戶和授權(quán)實(shí)現(xiàn)方式

    Spring Security的持久化用戶和授權(quán)實(shí)現(xiàn)方式

    文章介紹了如何使用JdbcUserDetailsManager實(shí)現(xiàn)數(shù)據(jù)庫讀取用戶,并展示了如何配置SpringSecurity進(jìn)行授權(quán)管理,通過創(chuàng)建數(shù)據(jù)庫表、配置數(shù)據(jù)庫連接和修改SecurityConfig,實(shí)現(xiàn)了用戶權(quán)限的控制
    2025-02-02
  • vue 使用vuex在頁面跳轉(zhuǎn)的實(shí)現(xiàn)方式

    vue 使用vuex在頁面跳轉(zhuǎn)的實(shí)現(xiàn)方式

    這篇文章主要介紹了vue 使用vuex在頁面跳轉(zhuǎn)的實(shí)現(xiàn)方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-08-08
  • MyBatis-Plus 主鍵生成策略的幾種實(shí)現(xiàn)方式

    MyBatis-Plus 主鍵生成策略的幾種實(shí)現(xiàn)方式

    主鍵生成策略是指在數(shù)據(jù)庫中為每條記錄生成唯一標(biāo)識(shí)符的方法,本文就來介紹一下MyBatis-Plus 主鍵生成策略的實(shí)現(xiàn),具有一定的參考價(jià)值,感興趣的可以了解一下
    2024-05-05
  • 詳解Java的面向?qū)ο蠛兔嫦蜻^程

    詳解Java的面向?qū)ο蠛兔嫦蜻^程

    我們知道,Java是面向?qū)ο蟮木幊陶Z言,但是至今仍有不少同學(xué)還不太懂”面向?qū)ο蟆暗拇_切含義,今天這篇文章就帶大家真正地認(rèn)識(shí)面向?qū)ο?,感興趣的同學(xué)可以跟著小編一起來學(xué)習(xí)
    2023-05-05
  • MyBatisPlus報(bào)錯(cuò):Failed to process,please exclude the tableName or statementId問題

    MyBatisPlus報(bào)錯(cuò):Failed to process,please exclud

    這篇文章主要介紹了MyBatisPlus報(bào)錯(cuò):Failed to process,please exclude the tableName or statementId問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-08-08
  • Java異常(Exception)處理以及常見異??偨Y(jié)

    Java異常(Exception)處理以及常見異??偨Y(jié)

    在《Java編程思想》中這樣定義異常,阻止當(dāng)前方法或作用域繼續(xù)執(zhí)行的問題,雖然java中有異常處理機(jī)制,但是要明確一點(diǎn),決不應(yīng)該用"正常"的態(tài)度來看待異常,這篇文章主要給大家介紹了關(guān)于Java異常(Exception)處理以及常見異常的相關(guān)資料,需要的朋友可以參考下
    2021-10-10
  • InputStreamReader和BufferedReader用法及實(shí)例講解

    InputStreamReader和BufferedReader用法及實(shí)例講解

    這篇文章主要介紹了InputStreamReader和BufferedReader用法及實(shí)例講解的相關(guān)資料,需要的朋友可以參考下
    2015-12-12
  • springboot+mybatis-plus實(shí)現(xiàn)內(nèi)置的CRUD使用詳解

    springboot+mybatis-plus實(shí)現(xiàn)內(nèi)置的CRUD使用詳解

    這篇文章主要介紹了springboot+mybatis-plus實(shí)現(xiàn)內(nèi)置的CRUD使用詳解,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-12-12
  • java 字符串相減(很簡(jiǎn)單的一個(gè)方法)

    java 字符串相減(很簡(jiǎn)單的一個(gè)方法)

    本篇文章是對(duì)java中關(guān)于字符串相減的一個(gè)簡(jiǎn)單的方法進(jìn)行了介紹,需要的朋友參考下
    2013-07-07
  • java如何用正則表達(dá)式匹配與提取字符串

    java如何用正則表達(dá)式匹配與提取字符串

    一位以前的同事在群里面突然發(fā)了個(gè)需求,要通過正則表達(dá)式來取值,下面這篇文章主要給大家介紹了關(guān)于java如何用正則表達(dá)式匹配與提取字符串的相關(guān)資料,需要的朋友可以參考下
    2022-06-06

最新評(píng)論

维西| 荥阳市| 宁强县| 衡东县| 襄垣县| 塔河县| 平陆县| 阿鲁科尔沁旗| 建德市| 高尔夫| 肇东市| 枞阳县| 玉山县| 奉新县| 禹州市| 浦东新区| 兴国县| 重庆市| 武平县| 克什克腾旗| 宝山区| 丽江市| 清丰县| 运城市| 灌阳县| 兴和县| 镇雄县| 云和县| 木里| 抚顺市| 屯门区| 株洲县| 前郭尔| 永川市| 辽中县| 新兴县| 抚顺市| 文昌市| 新平| 诸暨市| 通渭县|