[英]Elasticsearch nested object
這是我的映射模板。
{
"settings" : {
"number_of_shards" : 1,
"number_of_replicas" : 1
},
"mappings" : {
"couchbaseDocument" : {
"properties" : {
"doc" : {
"properties" : {
"exMaterialGroupID" : {
"type" : "string"
},
"materialGroupID" : {
"type" : "string"
},
"materialGroupValue" : {
"type" : "string"
},
"productID" : {
"type" : "string"
},
"productImagePath" : {
"type" : "string",
"fields" : {
"ersoy" : {
"type" : "string",
"index" : "not_analyzed"
}
}
},
"productName" : {
"type" : "string",
"fields" : {
"ersoy" : {
"type" : "string",
"index" : "not_analyzed"
}
}
},
"properties" : {
"type" : "nested",
"properties" : {
"id" : {
"type" : "long"
},
"name" : {
"type" : "string",
"fields" : {
"ersoy" : {
"type" : "string",
"index" : "not_analyzed"
}
}
},
"propertyGroupID" : {
"type" : "long"
}
}
},
"propertyGroups" : {
"properties" : {
"id" : {
"type" : "long"
},
"name" : {
"type" : "string",
"fields" : {
"ersoy" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}
},
"propertyOptions" : {
"properties" : {
"id" : {
"type" : "long"
},
"name" : {
"type" : "string",
"fields" : {
"ersoy" : {
"type" : "string",
"index" : "not_analyzed"
}
}
},
"propertyID" : {
"type" : "long"
}
}
},
"searchKey" : {
"type" : "string",
"fields" : {
"ersoy" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}
},
"meta" : {
"properties" : {
"expiration" : {
"type" : "long"
},
"flags" : {
"type" : "long"
},
"id" : {
"type" : "string"
},
"rev" : {
"type" : "string"
}
}
}
}
},
"couchbaseCheckpoint" : {
"properties" : {
"doc" : {
"properties" : {
"uuid" : {
"type" : "string"
}
}
}
}
}
}
}
我的問題是當使用此匯總搜索產品時
{
"aggs" : {
"product" : {
"nested" : {
"path" : "properties"
},
"aggs" : {
"id" : {
"terms" : {
"field" : "doc.properties.name.ersoy"
}
}
}
}
}
}
我得到這個錯誤。
{
"error": "SearchPhaseExecutionException[Failed to execute phase
[query_fetch], all shards failed; shardFailures {[bFRHdmHASWCZPk-tbyg4Zw] [elastic-products1][0]: AggregationExecutionException[[nested] nested path [properties] not found]}]",
"status": 500
}
我錯在哪里,我看不到。 誰能幫我
請嘗試使用此查詢,而不是僅在"properties"
嵌套路徑中需要"doc.properties"
"properties"
{
"aggs" : {
"product" : {
"nested" : {
"path" : "doc.properties" <---- fix this line
},
"aggs" : {
"id" : {
"terms" : {
"field" : "doc.properties.name.ersoy"
}
}
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.