下面的快照是不言自明的,但这是我正在尝试做的事情。我有一个双嵌套的 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}
最佳答案
查询中的嵌套路径不正确。
{
"query": {
"nested": {
"path": "stream",
"query": {
"nested": {
"path": "stream.tagging",
"query": {
"bool": {
"must": {
"match": {
"stream.tagging.tag": "product"
}
}
}
}
}
}
}
}
}
关于elasticsearch - Elasticsearch:嵌套映射在搜索上引发错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47345427/