Example of mapping a list of complex objects via Java API

I've been trying to figure out how to add a list of complex objects via the
Java API as illustrated in the guide here:

http://www.elasticsearch.org/guide/reference/mapping/array-type.html

  1. Is there an example of how to do this?
  2. I'd also be interested an example of how to populate the index via
    Java API.

I'm using version 0.18.7.

Thanks.

The index API (Elasticsearch Platform — Find real-time answers at scale | Elastic) can accept any form of json data (byte array, a string). So, you can create your own json with your favorite json lib, and feed it to the index operation (using the several setSource methods).

There is a built in embedded API to generate json (or smile format, which is a binary json format created by the jackson lib). Thats the one used in the example in the link above. It as different startArray methods.

On Friday, February 10, 2012 at 5:33 PM, Shane Witbeck wrote:

I've been trying to figure out how to add a list of complex objects via the Java API as illustrated in the guide here:

Elasticsearch Platform — Find real-time answers at scale | Elastic

Is there an example of how to do this?
I'd also be interested an example of how to populate the index via Java API.
I'm using version 0.18.7.

Thanks.

You didn't really answer my questions. I was looking for a specific example
using the Java API.

I resorted to externalizing the mapping to a file similar to how it's done
in ES tests.

Thanks anyway.