Update Byte Array Field Java API

Hi Everyone,

Has anyone ever experimented with or know of a way to update a field which
contains a byte array using the Java API? For example I have the following
index:

     client.prepareIndex(INDEX_NAME, INDEX_TYPE)
                .setSource(
                        jsonBuilder().startObject()
                            .field("_name", fileName)
                            .field("_content_type", "application/pdf")
                            .field("content", uploaded)
                        .endObject()
                ).execute().actionGet();

where the variable uploaded is of type byte[]. This indexing works great
for adding documents and getting them back from search results. However, I
haven't found a way to update the content field which holds the byte[]
which allows me to keep that feild's value as type byte[]. The method of
updating the index I was using is the following, but it requires that*
uploaded* be converted to a string.

String script = "ctx._source.content="" + uploaded + """;

    UpdateResponse repsonse = client.prepareUpdate(INDEX_NAME,INDEX_TYPE

, elasticSearchID)
.setScript(script)
.execute()
.actionGet();

This works to update other fields but it doesn't for the the byte[] array
field* content* because it needs to be a byte[] not a String for the way I
am using it. If it is not possible I can always change my approach to use
strings and convert them if necessary - just wondering if anyone knew of an
method to achieve what I am looking to do.

Thanks!

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/43500340-a34b-4978-bcda-b1cf6112bffb%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

I haven't tried the API, but in the script, it may be better to use base64
encoding for binary content. Don't ask how this is possible because I don't
know. Maybe not in MVEL but another language.

Jörg

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoG4RGKxkKzfAud%3Dq7YMuQq-X_K-v8C4GcCn3jZ2bANxvA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.