I have a problem with the java api for elasticsearch.
When I do a search like this:
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());
}
my response never has fields, can somebody help me ?
I'am using:
elasticsearch java api 1.4.0 elasticsearch 1.4.0
and my data looks like
{
"_index": "bookings",
"_type": "booking",
"_id": "50245171",
"_score": 1,
"_source": {
"field1": "value1",
"field2": "value2",
"field3": "value3",
...
}
}
the fields are not responding as fields....
with
hit.getSource()
i got my information