Hie team,
I am trying to fetch content of "message" field which is of type binary,but it returns null.
In elasticsearch data is stored as below
{
"_index": "twitter",
"_type": "_doc",
"_id": "56",
"_version": 1,
"_seq_no": 0,
"_primary_term": 1,
"found": true,
"_source": {
"message": "JVBERi0xLjcNCg0KNCAwIG9iag0KPDwNCi9FIDYwNDQyDQovSCBbIDM......"
}
}
My java code looks as below
GetRequest getRequest = new GetRequest("twitter","_doc", "56");
getRequest.fetchSourceContext(FetchSourceContext.FETCH_SOURCE);
getRequest.storedFields("message");
GetResponse getResponse = client().get(getRequest, RequestOptions.DEFAULT);
String message = getResponse.getField("message").getValue();
System.out.println("msg\t"+message);
It throws null pointer exception
When I am trying to execute via postman http://localhost:9200/twitter/_doc/56?stored_fields
. It is just returning
{
"_index": "twitter",
"_type": "_doc",
"_id": "56",
"_version": 1,
"_seq_no": 0,
"_primary_term": 1,
"found": true
}
How to fetch content of message ?