以下快照不言自明,但这就是我要做的事情。我有一个双嵌套字段 stream.tagging.tag ,我用新的映射重新创建了我的索引。但是当我进行搜索时,ES无法找到内部嵌套字段的路径。
nishant-osx:~ nishagar$ curl GET 'localhost:9200/stream_rules/_mappings?pretty'
{
"stream_rules": {
"mappings": {
"stream_rule": {
"properties": {
"stream": {
"type": "nested",
"properties": {
"tagging": {
"type": "nested",
"properties": {
"displayName": {
"type": "string"
},
"tag": {
"type": "string",
"index": "not_analyzed",
"store": true
}
}
}
}
}
}
}
}
}
}
nishant-osx:~ nishagar$ CURL 'localhost:9200/stream_rules/_search' -d '{
> "query": {
> "nested" : {
> "path" : "stream",
> "query" : {
> "nested": {
> "path": "tagging",
> "query": {
> "bool" : {
> "must" : { "match" : {"stream.tagging.tag" : "product"} }
> }
> }
> }
> }
> }
> }
> }'
{"error":"SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[Xh51BRC6SXekokw5jD5IzQ][stream_rules][0]: SearchParseException[[stream_rules][0]...
QueryParsingException[[stream_rules] [nested] failed to find nested object under path [tagging]]; }]","status":400}
答案 0 :(得分:0)
查询中的嵌套路径不正确。
{
"query": {
"nested": {
"path": "stream",
"query": {
"nested": {
"path": "stream.tagging",
"query": {
"bool": {
"must": {
"match": {
"stream.tagging.tag": "product"
}
}
}
}
}
}
}
}
}