I'm using Spring Data ElasticSearch to perform CRUD operations. By default, when a POJO annotated with @Document gets written to an ElasticSearch index, the index field names are the same as the POJO's Java property names. How can I configure the index field names to be different ? For example, with this Document POJO:
@Document(indexName = "areas", type = "area")
public class Area {
@Id
private String id;
private String countyName;
private String postOfficeName;
private String stateName;
how can I configure this so that the index field in ElasticSearch gets serialized as county_name instead of countyName ?