您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
elasticSearch索引别名
发布时间:2021-09-04 11:05:34编辑:雪饮阅读()
前面了解了ealsticSearch中在创建索引时候能够附加别名的配置,那么这次主要是了解下单独为一个已经建立的索引配置别名。
请求正文:
{
"actions" : [
{ "add" : { "index" : "schools", "alias" : "schools_pri" } }
]
}
响应正文:
{
"acknowledged": true
}
这里给schools这个索引配置了一个别名叫schools_pri.
那么有了别名之后,则可以直接根据别名来获取索引了(获取别名)
请求体:none
响应正文:
{
"schools": {
"aliases": {
"schools_pri": {}
},
"mappings": {
"properties": {
"city": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"description": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"fees": {
"type": "long"
},
"location": {
"type": "float"
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"rating": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"state": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"street": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"tags": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"zip": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"settings": {
"index": {
"routing": {
"allocation": {
"include": {
"_tier_preference": "data_content"
}
}
},
"number_of_shards": "1",
"provided_name": "schools",
"creation_date": "1630679580151",
"number_of_replicas": "1",
"uuid": "lvgO0EkkQMuW21PI6sQAtw",
"version": {
"created": "7140099"
}
}
}
}
}
关键字词:elasticSearch,索引,别名