Gönderilen benzer soruları gördüm, ama elbette, hiçbiri yapmaya çalıştığım tam olarak değil. Bu hatayı alıyorum aşağıdaki I sorguyu çalıştırdığınızdaElasticsearch: Yuvalanmış bir dizi sorgulama
:
"reason": "[nested] failed to find nested object under path [contentGroup]"
Sorun contentGroup bir dizi değil bir nesne olduğu için contentGroup.name yok olduğunu düşünüyorum. Bunun gibi bir şey olması gerekir: contentGroup [0] .name ve contentGroup [1] .name Ancak bunu nasıl yapacağımı anlayamıyorum.
Yanlış olabilecek başka bir şey, birbirinin içine yerleştirilmiş iki öğem olduğudur, bunun doğru olup olmadığını bilmiyorum.
Herhangi bir yardım harika olurdu!
Benim haritalama:
{
"mappings": {
"articles": {
"properties": {
"contentGroups": {
"type": "nested",
"properties": {
"contentGroup": {
"type": "nested",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
}
}
}
}
}
}
Ne bir makalede girdi oluşturulan alır (dizi Not yaratılan):
"contentGroups": {
"contentGroup": [
{
"name": "Breaking",
"id": "104"
},
{
"name": "News",
"id": "22"
}
]
Benim sorgusu:
{
"query": {
"bool": {
"must": [
{ "match": { "headline": "whatever" }},
{
"nested": {
"path": "contentGroup",
"query": {
"bool": {
"must": [
{ "match": { "contentGroup.name": "Breaking" }}
]
}
}
}
}
]
}
}
Bu benim için çalıştı! Böyle basit bir çözüm! Teşekkür ederiz! –