2016-06-23 5 views
0

i das Abfrageergebnis haben wie folgt ...Zugriff auf Array von Elasticsearch Dokumente mit AngularJS

{ 
    "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" 
          } 
         } 
        ] 
        } 
       } 
      } 
     ] 
     } 
    } 
} 

Ich möchte wie eine Tabelle angezeigt werden für jeden „Schlüssel“ alle Dokumente unter diesem Schlüssel gedruckt wird ... das erste Ergebnis würde

_________________________ 
key  | t_pacs_id 
_________________________ 
60  | 34 
      | 30 
      | 28 
------------------------- 
12  | 778 
      | 654 

ich habe sein dieser Code plunkr

aber der Code nur druckt die „Schlüssel“ nicht die „t_pacs_id“ ... ist es p Möglich dies zu tun ?? wenn ja, bitte vorschlagen.

vielen dank.

+0

ist 'console.log ($ scope.fhits);' Protokollierung? – adolfosrs

+0

Ihre Probe JSON ist nicht korrekt. Bitte fügen Sie richtig ein –

+1

ich aktualisierte die Fragen –

Antwort

0

Ersetzen:

 <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> 

mit:

 <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> 

Sollten Sie geben, was Sie suchen.

Plunker

+0

Vielen Dank Bgiggle es funktioniert ... –

Verwandte Themen