2016-09-19 90 views
0

我有弹性的多搜索查询,返回我3文档列表。弹性搜索:如何从弹性多搜索查询响应提取总数IMultiSearchResponse

在意义上的回应是这样的:

{ 
    "responses": [ 
     { 
     ... 
     "hits": { 
      "total": 0, 
      "max_score": null, 
      "hits": [] 
     } 
     }, 
     { 
     ... 
     "hits": { 
      "total": 0, 
      "max_score": null, 
      "hits": [] 
     } 
     }, 
     { 
     ... 
     "hits": { 
      "total": 0, 
      "max_score": null, 
      "hits": [] 
     } 
     } 
    ] 
} 

我打通的在C#中的文件列表3 “results.GetResponses()”。

但我不知道如何获得每个列表的总数?即总数?

+0

我想,你应该手动合并你的回应。 – hkulekci

回答

1

可以概括所有的答复total属性:

response.GetResponses<object>().Sum(r=>r.HitsMetaData.Total);