0
私は、次のタイプに分類さドキュメントでは、次の弾性検索インデックス、my-test-index
、持っている:相関タイプ
所有者を
{
"_index": "my-test-index",
"_type": "owner",
"_id": "AV4GXRQmXr6DxJJbKJTy",
"_source": {
"owner": "Jane",
"pet": "cat",
"city": "NYC"
}
},
{
"_index": "my-test-index",
"_type": "owner",
"_id": "AV4GXRQmXr6DxJJbKJT0",
"_source": {
"owner": "Jason",
"pet": "snake",
"city": "Boston"
}
},
{
"_index": "my-test-index",
"_type": "owner",
"_id": "AV4GXRQmXr6DxJJbKJTz",
"_source": {
"owner": "Jack",
"pet": "dog",
"city": "NYC"
}
},
とタイプ:
{
"_index": "my-test-index",
"_type": "type",
"_id": "AV4GXXuyXr6DxJJbKJUU",
"_source": {
"pet": "snake",
"type": "reptile"
}
},
{
"_index": "my-test-index",
"_type": "type",
"_id": "AV4GXXuyXr6DxJJbKJUT",
"_source": {
"pet": "dog",
"type": "mammal"
}
},
{
"_index": "my-test-index",
"_type": "type",
"_id": "AV4GXXuyXr6DxJJbKJUS",
"_source": {
"pet": "cat",
"type": "mammal"
}
},
{
"_index": "my-test-index",
"_type": "type",
"_id": "AV4GXXuyXr6DxJJbKJUW",
"_source": {
"pet": "penguin",
"type": "bird"
}
},
{
"_index": "my-test-index",
"_type": "type",
"_id": "AV4GXXuyXr6DxJJbKJUV",
"_source": {
"pet": "parrot",
"type": "bird"
}
}
私は各所有者が持っているペットの種類を知りたいと思います。例えば、ジェーンは猫が「哺乳類」のタイプなので、哺乳類を持っています。この情報を取得するためにElastic Searchにクエリを書き込むにはどうすればよいですか?または、単一のクエリでこれを実現することができない場合は、どうすれば次のステップを実行できますか?
- を使用すると、所有者の文書タイプが含まれている場合、これはクエリと簡単な言葉集約することwoudl
my-test-index/type