I am new to elasticsearch and looking for a bit of help using the Java API. I have some domain objects E.g.
@XmlRootElement
public class BasicActivity {
private String activityName;
private FullActivity activity;
// Getters and setters
}
I have created a transport client connected to a node
Client client = new TransportClient()
.addTransportAddress(new InetSocketTransportAddress("192.168.0.198",9300));
Is there and easy way to insert my object straight into elasticsearch?
I have seen this
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();
But to do that I would have to convert every object into json, which while possible is not my ideal situation.
If I have a misunderstanding of how it works (architecturally) then please let me know, I am here to learn!
cheers, Rob