Java API binary type example


(Shimi) #1

Is there an example/unit-test on how to use the Binary type in the
Java client API?


(Shay Banon) #2

The json/smile document you build should simply have a binary type to it.

On Sun, Jun 10, 2012 at 3:46 PM, Shimi shimi.k@gmail.com wrote:

Is there an example/unit-test on how to use the Binary type in the
Java client API?


(Shimi) #3

So I guess this is not the right way:

client.prepareIndex("indexname", "type1", "1")
.setSource(jsonBuilder.startObject
.field("index", "binary index")
.field("binary", Base64.decode("shimi"))
.endObject
)
.execute.actionGet

I will check json/smile

On Tue, Jun 12, 2012 at 1:11 PM, Shay Banon kimchy@gmail.com wrote:

The json/smile document you build should simply have a binary type to it.

On Sun, Jun 10, 2012 at 3:46 PM, Shimi shimi.k@gmail.com wrote:

Is there an example/unit-test on how to use the Binary type in the
Java client API?


(Shay Banon) #4

Just pass the byte array to it, also, the field should be mapped as binary.

On Tue, Jun 12, 2012 at 12:30 PM, Shimi Kiviti shimi.k@gmail.com wrote:

So I guess this is not the right way:

client.prepareIndex("indexname", "type1", "1")
.setSource(jsonBuilder.startObject
.field("index", "binary index")
.field("binary", Base64.decode("shimi"))
.endObject
)
.execute.actionGet

I will check json/smile

On Tue, Jun 12, 2012 at 1:11 PM, Shay Banon kimchy@gmail.com wrote:

The json/smile document you build should simply have a binary type to it.

On Sun, Jun 10, 2012 at 3:46 PM, Shimi shimi.k@gmail.com wrote:

Is there an example/unit-test on how to use the Binary type in the
Java client API?


(system) #5