0

これは私のマッピング テンプレートです。

{
"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
  }

どこが間違っているのか、わかりません。誰か助けてくれませんか

4

1 に答える 1

1

"doc.properties"代わりにこのクエリを試してください。単にではなく、ネストされたパスが必要です"properties"

{
 "aggs" : {
    "product" : {
     "nested" : {
            "path" : "doc.properties"       <---- fix this line
        },

        "aggs" : {
            "id" : {
                "terms" : {
                    "field" : "doc.properties.name.ersoy"
                }
            }
        }
    }
}
于 2015-07-31T12:05:45.747 に答える