2017-05-29 205 views

回答

0

我不知道,如果這個問題仍然是相關的,但對我來說這一次的工作:

String responseJson = "{\"took\":5,\"timed_out\":false,\"_shards\".....}"; 
try { 
    JsonXContentParser xContentParser = new JsonXContentParser(NamedXContentRegistry.EMPTY, 
    new JsonFactory().createParser(responseJson));  
    SearchResponse response = SearchResponse.fromXContent(xContentParser); 
    ... 
    Do Whatever 
    ... 
} catch (IOException e) { 
    handleException.... 
}