elasticsearch ElasticSearch返回404,而多索引、多类型搜索
我们有一个要求,其中我们需要跨多个索引进行查询,如下所示
elasticsearch ElasticSearch返回404,而多索引、多类型搜索,
elasticsearch,
elasticsearch,我们有一个要求,其中我们需要跨多个索引进行查询,如下所示 我们正在使用ElasticSearch 5.1.1。 查询: 然而,我们可能事先不知道该索引是否存在,如果上述任何一个索引不存在,我们将得到以下错误 { "error": { "root_cause": [ { "type": "index_not_found_exception", "reason": "no such in
我们正在使用ElasticSearch 5.1.1。
查询: 然而,我们可能事先不知道该索引是否存在,如果上述任何一个索引不存在,我们将得到以下错误
{
"error": {
"root_cause": [
{
"type": "index_not_found_exception",
"reason": "no such index",
"resource.type": "index_or_alias",
"resource.id": "index3",
"index_uuid": "_na_",
"index": "index3"
}
],
"type": "index_not_found_exception",
"reason": "no such index",
"resource.type": "index_or_alias",
"resource.id": "index3",
"index_uuid": "_na_",
"index": "index3"
},
"status": 404
}
一个明显的方法是检查索引是否已经存在,但我希望避免额外的调用。注意:至少会有一个索引始终存在
有可能避免此异常吗?
提前谢谢 “忽略不可用”是解决此问题的方法。将其作为搜索url中的查询参数传递。 埃克萨 即使两个索引中的任何一个都不存在,也不会给出404。解决方法是“忽略不可用”。将其作为搜索url中的查询参数传递。 埃克萨
即使其中一个索引不存在,这也不会给出404为什么不使用
索引*
,然后让ES解决具体的索引?谢谢回复!但我认为这会降低搜索速度,因为我们有300多个具有相同模式的索引,即“索引”,而且我们不想向消费者公开所有索引,我们只想公开他有权访问的索引。您应该尝试;-)为什么不使用索引*
,然后让ES解析具体的索引?谢谢回复!但我认为这会降低搜索速度,因为我们有300多个具有相同模式的索引,即“索引”,而且我们不想向消费者公开所有索引,我们只想公开他有权访问的索引。您应该尝试;-)
{
"error": {
"root_cause": [
{
"type": "index_not_found_exception",
"reason": "no such index",
"resource.type": "index_or_alias",
"resource.id": "index3",
"index_uuid": "_na_",
"index": "index3"
}
],
"type": "index_not_found_exception",
"reason": "no such index",
"resource.type": "index_or_alias",
"resource.id": "index3",
"index_uuid": "_na_",
"index": "index3"
},
"status": 404
}