How to request a single document by _id via alias?

后端 未结 4 1440
失恋的感觉
失恋的感觉 2021-01-11 20:36

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)?<

4条回答
  •  悲&欢浪女
    2021-01-11 21:16

    From Elasticsearch 5.1 the query looks like:

    GET /my_alias_name/_search/
    {
        "query": { 
            "bool": {
             "filter": {
                    "term": {
                       "_id": "AUwNrOZsm6BwwrmnodbW"
                    }
                }
            }
        }
    }
    

提交回复
热议问题