如何通过_id通过别名请求单个文档? [英] How to request a single document by _id via alias?

查看:98
本文介绍了如何通过_id通过别名请求单个文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果别名中所有索引上的所有键都是唯一的(这是一个外部保证),是否可以通过查询别名按其ID请求单个文档?

Is it possible to request a single document by its id by querying an alias, provided that all keys across all indices in the alias are unique (it is an external guarantee)?

推荐答案

是的,查询跨越多个索引的别名的方式与查询一个索引的方式相同。

Yes, querying an alias spanning over multiple indices work the same way as querying one indice.

通过别名查询:

POST my_alias_name/_search
{
    "filter":{
        "term":{"_id": "AUwNrOZsm6BwwrmnodbW"}
    }
}

编辑:GET操作不是真正的搜索,不能对跨越多个索引的别名进行。因此,实际上不允许以下查询:

GET operations are not real searches and can't be done on aliases spanning over multiple indexes. So the following query is in fact no permitted:

GET my_alias_name/my_type/AUwNrOZsm6BwwrmnodbW

这篇关于如何通过_id通过别名请求单个文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆