Use of _id for document identifier in elastic search
<p>I have a document with _id as a parameter. I have the below JSON</p>

<pre><code>{  
   "_id":{  
      "$oid":"52af48b5d55148fa0c199643"
   },
   "email":"example.ex@example.com"
}
</code></pre>

<p>Corresponding Java class:</p>

<pre><code>@Document(indexName = "Test")
public class Test {

  @Id
  @ObjectId
  private String _id;

  private String email;
}
</code></pre>

<p>The conversion of json object is successful but there is a problem in saving the data to elastic search.</p>

<pre><code>org.elasticsearch.index.mapper.MapperParsingException: Field [_id] is a metadata field and cannot be added inside a document. Use the index API request parameters
</code></pre>

<p>I have seen some references and came to a conclusion that i cannot use _id.. But am looking for a way to use a JsonProperty but it also does not work as i guess ObjectId uses JsonProperty internally.</p>

<p>Kindly provide suggestions</p>