Yes, I looked at that link but it is not related to my question.
I have a SearchResponse as a response for a query that request only some
fields from the object (I mentioned in my initial post the link to the
query type
Elasticsearch Platform — Find real-time answers at scale | Elastic):
SearchRequestBuilder requestBuilder = client.prepareSearch....
requestBuilder.addFields("field1", "field5.subField2", "field7")
Now, I want to build my objects from the response.
SearchHits hitsInfo = response.getHits()
SearchHit hits = hitsInfo.hits()
for (SearchHit hit : hits) {
// here, hit.getSourceAsString() returns null
Map<String, SearchHitField> fields = hit.fields()
MyFullObject obj = decodeMyFullObject(hit)}
So, my MyFullObject must be populated with that fields (that represent a
part of all MyFullObject fields) returned by the response.
Thanks,
Mihai
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.