首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >用AngularJS访问elasticsearch文档数组

用AngularJS访问elasticsearch文档数组
EN

Stack Overflow用户
提问于 2016-06-23 14:18:54
回答 1查看 44关注 0票数 0

查询结果如下..。

代码语言:javascript
复制
{
   "took": 6,
   "timed_out": false,
   "_shards": {
      "total": 5,
      "successful": 5,
      "failed": 0
   },
   "hits": {
      "total": 45,
      "max_score": 0,
      "hits": []
   },
   "aggregations": {
      "by_id": {
         "doc_count_error_upper_bound": 0,
         "sum_other_doc_count": 0,
         "buckets": [
            {
               "key": "60",
               "doc_count": 21,
               "tops": {
                  "hits": {
                     "total": 21,
                     "max_score": 2.2237754,
                     "hits": [
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_135",
                           "_id": "AVU7i0nnXK6g_oqHu-az",
                           "_score": 2.2237754,
                           "_source": {
                              "t_pacs_id": "34",
                              "t_id": "60",
                              "matching": "MO",
                              "UICriteria": "135",
                              "t_match": "matched",
                              "t_criteria": "Accession Number;Patient Identifier;Last Name;Date of Birth;Sex;Modality"
                           }
                        },
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_143",
                           "_id": "AVU7iOSeXK6g_oqHu-XY",
                           "_score": 2.2237754,
                           "_source": {
                              "t_pacs_id": "30",
                              "t_id": "60",
                              "matching": "MO",
                              "UICriteria": "143",
                              "t_match": "matched",
                              "t_criteria": "Accession Number;Patient Identifier;Last Name"
                           }
                        },
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_135",
                           "_id": "AVU7i0nlXK6g_oqHu-ay",
                           "_score": 2.2237754,
                           "_source": {
                              "t_pacs_id": "28",
                              "t_id": "60",
                              "matching": "MO",
                              "UICriteria": "135",
                              "t_match": "matched",
                              "t_criteria": "Accession Number;Patient Identifier;Last Name;Date of Birth;Sex;Modality"
                           }
                        }
                     ]
                  }
               }
            },
            {
               "key": "12",
               "doc_count": 4,
               "tops": {
                  "hits": {
                     "total": 4,
                     "max_score": 2.2237754,
                     "hits": [
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_121",
                           "_id": "AVU9LoC9XK6g_oqHvAal",
                           "_score": 2.2237754,
                           "_source": {
                              "t_pacs_id": "778",
                              "t_id": "12",
                              "matching": "MO",
                              "UICriteria": "121",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        },
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_144",
                           "_id": "AVVTNXkQyjsrQd4jgajJ",
                           "_score": 2.098612,
                           "_source": {
                              "t_pacs_id": "654",
                              "t_id": "12",
                              "matching": "MO",
                              "UICriteria": "144",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        },
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_144",
                           "_id": "AVVTNXkOyjsrQd4jgajI",
                           "_score": 1.9007865,
                           "_source": {
                              "t_pacs_id": "778",
                              "t_id": "12",
                              "matching": "MO",
                              "UICriteria": "144",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        }
                     ]
                  }
               }
            },
            {
               "key": "22",
               "doc_count": 4,
               "tops": {
                  "hits": {
                     "total": 4,
                     "max_score": 2.098612,
                     "hits": [
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_144",
                           "_id": "AVVTNXkXyjsrQd4jgajM",
                           "_score": 2.098612,
                           "_source": {
                              "t_pacs_id": "778",
                              "t_id": "22",
                              "matching": "MO",
                              "UICriteria": "144",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        },
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_121",
                           "_id": "AVU9LoDLXK6g_oqHvAaq",
                           "_score": 1.9007865,
                           "_source": {
                              "t_pacs_id": "654",
                              "t_id": "22",
                              "matching": "MO",
                              "UICriteria": "121",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        },
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_144",
                           "_id": "AVVTNXkYyjsrQd4jgajN",
                           "_score": 1.8690379,
                           "_source": {
                              "t_pacs_id": "654",
                              "t_id": "22",
                              "matching": "MO",
                              "UICriteria": "144",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        }
                     ]
                  }
               }
            },
            {
               "key": "48",
               "doc_count": 4,
               "tops": {
                  "hits": {
                     "total": 4,
                     "max_score": 2.098612,
                     "hits": [
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_144",
                           "_id": "AVVTNXkGyjsrQd4jgajG",
                           "_score": 2.098612,
                           "_source": {
                              "t_pacs_id": "778",
                              "t_id": "48",
                              "matching": "MO",
                              "UICriteria": "144",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        },
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_121",
                           "_id": "AVU9LoCyXK6g_oqHvAaj",
                           "_score": 1.7621399,
                           "_source": {
                              "t_pacs_id": "778",
                              "t_id": "48",
                              "matching": "MO",
                              "UICriteria": "121",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        },
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_121",
                           "_id": "AVU9LoCzXK6g_oqHvAak",
                           "_score": 1.7621399,
                           "_source": {
                              "t_pacs_id": "654",
                              "t_id": "48",
                              "matching": "MO",
                              "UICriteria": "121",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        }
                     ]
                  }
               }
            },
            {
               "key": "83",
               "doc_count": 4,
               "tops": {
                  "hits": {
                     "total": 4,
                     "max_score": 2.098612,
                     "hits": [
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_121",
                           "_id": "AVU9LoDVXK6g_oqHvAas",
                           "_score": 2.098612,
                           "_source": {
                              "t_pacs_id": "654",
                              "t_id": "83",
                              "matching": "MO",
                              "UICriteria": "121",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        },
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_144",
                           "_id": "AVVTNXkeyjsrQd4jgajP",
                           "_score": 2.098612,
                           "_source": {
                              "t_pacs_id": "654",
                              "t_id": "83",
                              "matching": "MO",
                              "UICriteria": "144",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        },
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_121",
                           "_id": "AVU9LoDUXK6g_oqHvAar",
                           "_score": 1.8690379,
                           "_source": {
                              "t_pacs_id": "778",
                              "t_id": "83",
                              "matching": "MO",
                              "UICriteria": "121",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        }
                     ]
                  }
               }
            },
            {
               "key": "90",
               "doc_count": 4,
               "tops": {
                  "hits": {
                     "total": 4,
                     "max_score": 2.2237754,
                     "hits": [
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_144",
                           "_id": "AVVTNXj_yjsrQd4jgajE",
                           "_score": 2.2237754,
                           "_source": {
                              "t_pacs_id": "778",
                              "t_id": "90",
                              "matching": "MO",
                              "UICriteria": "144",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        },
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_121",
                           "_id": "AVU9LoCtXK6g_oqHvAai",
                           "_score": 2.098612,
                           "_source": {
                              "t_pacs_id": "654",
                              "t_id": "90",
                              "matching": "MO",
                              "UICriteria": "121",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        },
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_121",
                           "_id": "AVU9LoCrXK6g_oqHvAah",
                           "_score": 1.9007865,
                           "_source": {
                              "t_pacs_id": "778",
                              "t_id": "90",
                              "matching": "MO",
                              "UICriteria": "121",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        }
                     ]
                  }
               }
            },
            {
               "key": "945",
               "doc_count": 4,
               "tops": {
                  "hits": {
                     "total": 4,
                     "max_score": 1.9007865,
                     "hits": [
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_144",
                           "_id": "AVVTNXkTyjsrQd4jgajK",
                           "_score": 1.9007865,
                           "_source": {
                              "t_pacs_id": "778",
                              "t_id": "945",
                              "matching": "MO",
                              "UICriteria": "144",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        },
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_121",
                           "_id": "AVU9LoDEXK6g_oqHvAao",
                           "_score": 1.8690379,
                           "_source": {
                              "t_pacs_id": "654",
                              "t_id": "945",
                              "matching": "MO",
                              "UICriteria": "121",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        },
                        {
                           "_index": "automatch_testing",
                           "_type": "temp_144",
                           "_id": "AVVTNXkUyjsrQd4jgajL",
                           "_score": 1.8690379,
                           "_source": {
                              "t_pacs_id": "654",
                              "t_id": "945",
                              "matching": "MO",
                              "UICriteria": "144",
                              "t_match": "matched",
                              "t_criteria": "Middle Name"
                           }
                        }
                     ]
                  }
               }
            }
         ]
      }
   }
}

我想显示一个表格,就像每个“键”下的所有文件都打印出来.第一个结果是

代码语言:javascript
复制
_________________________
key       |  t_pacs_id
_________________________
60        |    34
          |    30
          |    28
-------------------------
12        |    778
          |    654

我有这个代码普鲁克尔

但是代码只打印“键”,而不是"t_pacs_id"...is,可以这样做吗??如果是的话,请建议。

非常感谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-06-23 15:06:53

取代:

代码语言:javascript
复制
      <tr ng-repeat="hit in fhits">             
          <td> {{ hit.key}} </td>
          -<div data-ng-repeat="i in range">
              <div ng-repeat="rhit in hit.tops.hits.hits">
                        <td > {{ rhit }} </td>
              </div>
          </div>
      </tr>

通过以下方式:

代码语言:javascript
复制
      <tr ng-repeat="hit in fhits">

          <td> {{hit.key}} </td>

          <td>
            <div ng-repeat="hits in hit.tops.hits">
              <div ng-repeat="rhit in hits">
                {{rhit._source.t_pacs_id}}
              </div>
            </div>  
          </td>
      </tr>

应该给你你想要的东西。

柱塞

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37994317

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档