2016-08-03 51 views

回答

1

在迭代響應匹配時,可以使用SearchHit.field("_parent")方法來檢索父文檔的ID。

SearchResponse response = client.prepareSearch().execute().actionGet(); 
for (SearchHit hit : response.getHits().getHits()) { 
    SearchHitField parent = hit.field("_parent"); 
} 
+0

It works.Thanks!謝謝! –

+0

很高興幫助! – Val

+0

我還有一個問題。 http://stackoverflow.com/questions/38738573/how-to-know-if-a-type-of-a-index-has-parent-or-child-relationship-in-elasticsear –

相關問題