Save and get byte [] in Elasticsearch

I have a byte [] array. Let be -

byte[] b = new byte[] {'11', '22', '33', '44'};

      

I want to store this array in Elasticsearch and get this byte array from elasticsearch using java. How should I do it? Please show me an example.

For example, I want to see something like this -

SearchHit hit = searchResponse.getHits().getHits();
byte[] b = (byte[]) hit.getSource().get("byte_array");

      

But I am getting this error. Please help me

java.lang.ClassCastException: java.util.ArrayList cannot be cast to [B

      

+3


source to share





All Articles