I am persisting data through elasticsearch and even though the data is persisted multiple times, it will be stored with auto-generated different string id values. I want multiple entries of the same data to be avoided from being persistence by making the email field as the primary key. How could I achieve this in elasticsearch
{
"email":"[email protected]",
"name": "abc"
}
return client.prepareIndex(Constants.INDEX_NAME, Constants.TYPE)
.setSource(XContentFactory.jsonBuilder()
.startObject()
.field("email", email)
.field("name", name)
.endObject())
.get();