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
java bytearray elasticsearch


source to share


No one has answered this question yet

Check out similar questions:

23498
Why is processing a sorted array faster than processing an unsorted array?
3393
Create ArrayList from array
2248
Is a finally block always executable in Java?
2171
How to determine if an array contains a specific value in Java?
1823
What's the easiest way to print a Java array?
1367
Fastest way to determine if an integer square root is an integer
935
Eclipse Cannot Start - Java was started but exit code returned = 13
783
Convert InputStream array to bytes in Java
608
How to convert byte array to string
598
How can I convert a byte array to a hex string in Java?



All Articles
Loading...
X
Show
Funny
Dev
Pics