0
私はこれを以下のようにマッピングしており、最も内側のレベルのネストされた要素をクエリしようとしていますが、エラーが出ます。複数レベルのネストされたオブジェクトの弾性検索
マッピング:
{
"search_v1" : {
"mappings" : {
"statement" : {
"properties" : {
"details" : {
"type" : "text",
},
"source" : {
"type" : "nested",
"properties" : {
"affiliation" : {
"type" : "nested",
"properties" : {
"name" : {
"type" : "text"
}
}
},
"first_name" : {
"type" : "text"
},
"last_name" : {
"type" : "text"
}
}
}
}
}
}
}
}
データ:
{
"_index" : "search_v1",
"_type" : "statement",
"_id" : "AVTHp5y8yr47EGbDlTWu",
"_score" : 1.0,
"_source" : {
"details" : "test test",
"source" : {
"first_name" : "source2",
"last_name" : "source2",
"affiliation" : [ {
"name" : "affiliation1"
}, {
"name" : "affiliation2"
}, {
"name" : "affiliation4"
} ]
}
}
}
問合せ:
{
"query": {
"bool": {
"must": [
{
"nested": {
"path": "source",
"query": {
"bool": {
"must": [ {
"nested": {
"path": "affiliation",
"query": {
"bool": {
"must": [
{ "match": { "affiliation.name": "affiliation2" }}
]
}}}}
]
}}}}
]
}}}
エラー: query_shard_exception:私がしようとした場合、クエリ
の作成に失敗しました。クエリsource.first_nameそれは動作しますが、私は1レベル深く行くと、エラーが発生します。
ありがとうございました。
その任意の結果を与えていない、所属もネストされたオブジェクトである、あなたの元のクエリを使用しますが、試合中に完全修飾パスを使用する方法についてについてソース –
でもっとして1人の所属があることができますか? '{"一致 ":{" source.affiliation.name ":" affiliation2 "}}' –
はい、これを試しましたが、それも動作しませんでした –