我正在尝试从 ElasticSearch 查询中检索嵌套数据,基本上是尝试从 Movie 模型中获取:
title
ratings
categories
现在,我尝试了 2 个轮胎设置,但都只返回电影标题,而不是评分或类别。例如,索引似乎只有:
curl -X POST "http://localhost:9200/movies/_search?pretty=true" -d '
{
“查询”:{“查询字符串”:{“查询”:“t*”}},
“方面”:{
“类别”:{“条款”:{“字段”:“类别”}}
}
}
'
{
“接受”:16,
“超时”:假,
“_shards”:{
“总数”:5,
“成功”:5,
“失败”:0
},
“命中”:{
“总数”:3,
“最大分数”:1.0,
“命中”:[{
"_index" : "电影",
"_type" : "电影",
“_id”:“13”,
“_score”:1.0,“_source”:{“description”:null,“id”:13,“title”:“小塑料人”}
}, {
"_index" : "电影",
"_type" : "电影",
“_id”:“32”,
"_score" : 1.0, "_source" : {"description":null,"id":32,"title":"The Extreme Truth"}
}, {
"_index" : "电影",
"_type" : "电影",
“_id”:“39”,
“_score”:1.0,“_source”:{“description”:null,“id”:39,“title”:“一天中的时间”}
}]
},
“方面”:{
“类别”:{
“_type”:“条款”,
“失踪”:3,
“总计”:0,
“其他”:0,
“条款”:[]
}
}
这是我的电影模型:
电影类:分类
属于_to:用户
has_many :评分
映射做
索引:id,类型:'整数'
索引:标题,提升:40
索引:描述,分析器:“雪球”
索引:类别做
索引:id,类型:'整数'
索引:名称,类型:'string',索引:'not_analyzed'
结尾
指数:评级做
索引:id,类型:'整数'
索引:星,类型:'整数'
结尾
结尾
结尾
我的搜索实验的分支在这里:https ://github.com/mulderp/moviedb/tree/categories
我怎样才能使搜索的各个方面起作用,例如流派 --> 评级。