我对 elasticsearch 的 java api 有疑问。
当我进行这样的搜索时:
MatchQueryBuilder query = QueryBuilders.matchQuery("_type", "booking");
SearchResponse searchResponse = client.prepareSearch().setQuery(query).execute().actionGet();
for (SearchHit hit : searchResponse.getHits()){
Map<String, SearchHitField> fields = hit.getFields();
System.out.println(fields.size());
}
我在用:
弹性搜索 java api 1.4.0 弹性搜索 1.4.0
我的数据看起来像
{
"_index": "bookings",
"_type": "booking",
"_id": "50245171",
"_score": 1,
"_source": {
"field1": "value1",
"field2": "value2",
"field3": "value3",
...
}
}