我有属于一个流派,并有多个评级的电影。使用ElasticSearch,我想先对流派进行分面搜索,然后再进行评分。如何阅读分面搜索查询的JSON输出?
我读到有关的想法在这里:http://www.elasticsearch.org/guide/reference/api/search/facets/
但我很困惑如何理解这种卷曲查询的输出:我有一些电影是用“T”开始
curl -X POST "http://localhost:9200/movies/_search?pretty=true" -d ' { "query" : { "query_string" : {"query" : "T*"} }, "facets" : { "categories" : { "terms" : {"field" : "categories"} } } } ' { "took" : 35, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 3, "max_score" : 1.0, "hits" : [ { "_index" : "movies", "_type" : "movie", "_id" : "13", "_score" : 1.0, "_source" : {"category_id":2,"created_at":"2013-05-03T16:40:21Z","description":null,"title":"Tiny Plastic Men","updated_at":"2013-05-03T16:40:21Z","user_id":null} }, { "_index" : "movies", "_type" : "movie", "_id" : "32", "_score" : 1.0, "_source" : {"category_id":14,"created_at":"2013-05-03T16:55:02Z","description":null,"title":"The Extreme Truth","updated_at":"2013-05-03T16:55:02Z","user_id":null} }, { "_index" : "movies", "_type" : "movie", "_id" : "39", "_score" : 1.0, "_source" : {"category_id":7,"created_at":"2013-05-03T16:55:02Z","description":null,"title":"A Time of Day","updated_at":"2013-05-03T16:55:02Z","user_id":null} } ] }, "facets" : { "categories" : { "_type" : "terms", "missing" : 3, "total" : 0, "other" : 0, "terms" : [ ] } }
,但另外我会期望来自类型/类别'颤栗'的电影。
因此,我可以从上面的JSON读取什么?
嗯......好吧,谢谢你,我可能需要微调我的轮胎设置加载类即可。我将探索这条路线。 – poseid 2013-05-05 07:51:50