赞
踩
首先说明es中索引的字段类型是不可修改的,只能是重新创建一个索引并设置好mapping,然后再将老索引的数据复制过去。
- PUT /web-log
- {
- "mappings" : {
- "properties" : {
- "classMethod" : {
- "type" : "text",
- "fields" : {
- "keyword" : {
- "type" : "keyword",
- "ignore_above" : 256
- }
- }
- },
- "consumeTime" : {
- "type" : "long"
- },
- "consumeTimeType" : {
- "type" : "text",
- "fields" : {
- "keyword" : {
- "type" : "keyword",
- "ignore_above" : 256
- }
- }
- },
- "date" : {
- "type" : "date",
- "format": "yyyy-M-d"
- },
- "day" : {
- "type" : "long"
- },
- "hour" : {
- "type" : "long"
- },
- "ip" : {
- "type" : "text",
- "fields" : {
- "keyword" : {
- "type" : "keyword",
- "ignore_above" : 256
- }
- }
- },
- "minute" : {
- "type" : "long"
- },
- "month" : {
- "type" : "long"
- },
- "requestArgs" : {
- "type" : "text",
- "fields" : {
- "keyword" : {
- "type" : "keyword",
- "ignore_above" : 256
- }
- }
- },
- "requestId" : {
- "type" : "text",
- "fields" : {
- "keyword" : {
- "type" : "keyword",
- "ignore_above" : 256
- }
- }
- },
- "requestMethod" : {
- "type" : "text",
- "fields" : {
- "keyword" : {
- "type" : "keyword",
- "ignore_above" : 256
- }
- }
- },
- "second" : {
- "type" : "long"
- },
- "threadID" : {
- "type" : "text",
- "fields" : {
- "keyword" : {
- "type" : "keyword",
- "ignore_above" : 256
- }
- }
- },
- "timestamp" : {
- "type" : "long"
- },
- "userName" : {
- "type" : "text",
- "fields" : {
- "keyword" : {
- "type" : "keyword",
- "ignore_above" : 256
- }
- }
- },
- "year" : {
- "type" : "long"
- }
- }
- }
- }
- POST _reindex
- {
- "source": {
- "index": "web_log"
- },
- "dest": {
- "index": "web-log"
- }
- }
最后成功了
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。