这是我的模型在弹性搜索中的索引
{
"_index":"cars",
"_type":"car",
"_id":"3275",
"_version":4,
"_score":1,
"_source":{
"category_id": 6,
"car_branches":[
{
"id":32,
"name":"Type1"
},
{
"id":33,
"name":"Type2"
},
{
"id":36,
"name":"Type3"
}
],
}
}
我可以使用查询 category_id
Car.__elasticsearch__.search query:{match:{category_id: 6}}
如何查询 car_branches?我试过这个
response = Car.__elasticsearch__.search query:{match:{car_branches:[id: 32]}}
我正进入(状态Elasticsearch::Transport::Transport::Errors::BadRequest: [400]