gpt4 book ai didi

elasticsearch - 是否可以使用 ElasticSearch 别名写入多个索引?

转载 作者:行者123 更新时间:2023-11-29 02:43:56 26 4
gpt4 key购买 nike

ElasticSearch Docs阅读:

An alias can also be mapped to more than one index, and when specifying it, the alias will automatically expand to the aliases indices.

但是当我尝试向 2 个索引添加别名并写入两者时,文档似乎都没有更新。如果我删除其中一个别名,它将正确写入仍然存在的别名。

多个写入别名失败:

$ curl -XGET 'http://localhost:9200/_aliases'

结果:

{
"dev_01": {
"aliases": {
"dev_read": {},
"dev_write": {}
}
},
"dev": {
"aliases": {
"dev_write": {}
}
}
}

使用单个别名:

$ curl -XGET 'http://localhost:9200/_aliases'

结果:

{
"dev_01": {
"aliases": {
"dev_read": {},
"dev_write": {}
}
},
"dev": {
"aliases": {}
}
}

elasticsearch是否支持写入多个索引?如果指向多个索引,别名是否为只读?

最佳答案

答案是否定的

所以看起来我应该更深入地对这个哔哔声进行分类,但我的客户从 es 得到的响应是:

ElasticSearchIllegalArgumentException[Alias [dev_write] has more than one indices associated with it [[dev_01, dev]], can't execute a single index op

只愿the docs前面更明确一些,因为他们让我有点困惑

起初似乎暗示你可以:

The index aliases API allow to alias an index with a name, with all APIs automatically converting the alias name to the actual index name. An alias can also be mapped to more than one index...

Associating an alias with more than one index are simply several add actions...

页面下方让您知道您不能:

It is an error to index to an alias which points to more than one index.

关于elasticsearch - 是否可以使用 ElasticSearch 别名写入多个索引?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19661822/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com