title: elasticsearch insert objects into index
body: <p>I am new to elasticsearch and looking for a bit of help using the Java API.  I have some domain objects 
  E.g. </p>
  
  <pre><code>@XmlRootElement
  
  public class BasicActivity {
  
  private String activityName;
  private FullActivity activity;  
  // Getters and setters
  }
  </code></pre>
  
  <p>I have created a transport client connected to a node</p>
  
  <pre><code>Client client = new TransportClient()
          .addTransportAddress(new InetSocketTransportAddress("192.168.0.198",9300));
  </code></pre>
  
  <p><strong>Is there and easy way to insert my object straight into elasticsearch?</strong></p>
  
  <p>I have seen this</p>
  
  <pre><code>IndexResponse response = client.prepareIndex("twitter", "tweet", "1")
                      .setSource(jsonBuilder()
                                  .startObject()
                                      .field("user", "kimchy")
                                      .field("postDate", new Date())
                                      .field("message", "trying out Elastic     Search")
                                  .endObject()
                                )
                      .execute()
                      .actionGet();
  </code></pre>
  
  <p>But to do that I would have to convert every object into json, which while possible is not my ideal situation.</p>
  
  <p>If I have a misunderstanding of how it works (architecturally) then please let me know, I am here to learn!</p>
  
  <p>cheers,
  Rob</p>