我创建了两个测试索引和一个与之关联的别名:
POST /_aliases
{
"actions" : [
{
"add" : {
"index" : "test",
"alias" : "alias_test",
"index_routing" : "1"
}
},
{
"add" : {
"index" : "test2",
"alias" : "alias_test"
}
}
]
}
但是,当我尝试使用routing = 1将文档索引到测试索引时,它仍然会抛出错误:
POST alias_test/test/test?routing=1
{
"user" : "kimchy",
"post_date" : "2009-11-15T14:12:12",
"message" : "trying out Elasticsearch"
}
错误讯息:
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Alias [alias_test] has more than one indices associated with it [[test2, test]], can't execute a single index op"
}
],
"type": "illegal_argument_exception",
"reason": "Alias [alias_test] has more than one indices associated with it [[test2, test]], can't execute a single index op"
},
"status": 400
}
任何建议?
答案 0 :(得分:1)
如果要索引新文档,则不能使用指向多个索引的别名,在这种情况下,您需要使用索引名称
x