数据库类型之间的切换:假如本来是存储string类型的数据库,错误地存储成了date,导致后边存储string类型的数据的时候存储不进去,怎么办呢?
再创建一个数据库,将之前的数据库设置别名,然后 将现在的数据库设置文本存储的类型,为text类型
将之前的数据库中的数据批量查询出来,在现在数据库中批量存储进去
最后将新的数据库的别名设置为原来数据库别名之前的名字
最后将之前数据库的别名切换到新的数据库,致使新的数据库的别名为原来数据库的别名,将原来数据库的别名删掉(切换)
PUT /test_index/test_type/3
{
"date":"2013-03-03"
}
GET /test_index/test_type/_search?scroll=1m
{
"query": {
"range": {
"date": {
"gte": "2012-02-02",
"lte": "2015-05-05"
}
}
},
"sort": [
{
"age": {
"order": "asc"
}
}
],
"size": 1
}
GET /test_index/_mapping/test_type
PUT /test_index/test_type/3
{
"date":"my first article"
}
PUT /test_index/_mapping/test_type/1
{
"properties":{
"date":{
"type":"text"
}
}
}
PUT /test_index/_alias/good_index
PUT /test_index_neww
{
"mappings": {
"test_type":{
"properties": {
"date":{
"type": "text"
}