【发布时间】:2017-12-27 14:00:48
【问题描述】:
我有以下疑问:
GET product,account/producttype,accounttype/_search
{
"query": {
"bool": {
"should": [
{
"bool": {
"must": [
{
"nested": {
"query": {
"bool": {
"should": [
{
"match": {
"keywords.keyword": {
"query": "search query"
}
}
},
{
"term": {
"keywords.keyword.keyword": {
"value": "search query"
}
}
}
]
}
},
"path": "keywords"
}
}
],
"filter": [
{
"term": {
"_index": {
"value": "product"
}
}
}
]
}
},
{
"bool": {
"must": [
{
"multi_match": {
"query": "search query",
"operator": "or",
"fields": [
"accountName^1.5",
"description^0.8"
]
}
}
],
"filter": [
{
"term": {
"_type": {
"value": "accounttype"
}
}
}
]
}
}
]
}
}
}
当我运行上面的查询时,我得到了这个异常:
"index": "账户", “引起的”:{ “类型”:“非法状态异常”, "reason": "[nested] 未能在路径 [keywords] 下找到嵌套对象" }
在索引帐户内部没有称为关键字的嵌套对象。
过去使用 Indices 查询来解决此问题,但现在已弃用。
现在正如上面的查询所示:我正在使用 _index 过滤,但它仍然给我这个错误。
那么,您能否指导我摆脱该异常并让我的查询正常工作?
PS:
我正在使用elasticsearch v5.1.1
【问题讨论】:
-
嘿,这可能有点远,但我也遇到了同样的麻烦。你解决了吗?
标签: elasticsearch