【发布时间】:2016-01-03 16:09:01
【问题描述】:
我有以下 Elasticsearch 查询。
GET /index1,index2/type1,type2/_search?q=programming
假设我想从这个搜索查询中排除 index2。 documentation states the following:
它还支持通配符,例如:test*,以及 “添加”(+)和“删除”(-),例如:+test*,-test3。
据我所知,我应该能够做到以下几点。
GET /+index1,-index2/type1,type2/_search?q=programming
但是,我收到以下错误。
{
"error": {
"root_cause": [
{
"type": "index_not_found_exception",
"reason": "no such index",
"resource.type": "index_or_alias",
"resource.id": " index1",
"index": " index1"
}
],
"type": "index_not_found_exception",
"reason": "no such index",
"resource.type": "index_or_alias",
"resource.id": " index1",
"index": " index1"
},
"status": 404
}
如果我删除加号和减号,查询运行正常。如果我添加通配符,它似乎可以工作,例如下面的查询。
GET /index1,-*index2/type1,type2/_search?q=programming
然而,这并不是我真正想要的。
为什么当我使用加号和减号来包含或排除文档所述的索引时,我的查询不起作用?我是不是误会了什么?
我使用的是 Elasticsearch 2.1。
【问题讨论】:
标签: elasticsearch