【发布时间】:2017-09-14 18:58:06
【问题描述】:
我想要每个用户文档的平均评分,但根据我的说法不起作用。请检查下面给出的代码。
curl -XGET 'localhost:9200/mentorz/users/_search?pretty' -H 'Content-Type: application/json' -d'
{"aggs" : {"avg_rating" : {"range" : {"field" : "rating","ranges" : [{ "from" : 3, "to" : 19 }]}}}}';
{“_index”:“mentorz”,“_type”:“用户”,“_id”:“555”,“_source”:{“name”:“neeru”,“user_id”:555,“email_id” :“abc@gmail.com”,“关注者”:0, “以下”:0,“导师”:0,“受指导者”:0,“basic_info”:“api测试信息”, “birth_date”:1448451985397,“charge_price”:0,“org”:“cz”,“located_in”:“noida”,“position”:“sw developer”,“exp”:7,“video_bio_lres”:“test bio lres url normal signup","video_bio_hres" : "test bio hres url normal signup", "rating" : [ 5 ,4], "expertises" : [ 1, 4, 61, 62, 63 ] } 这是我的用户文档,我只想过滤平均评分范围为 3 到 5 的用户。
【问题讨论】:
标签: elasticsearch