SpringDataElasticsearchDevs / spring-data-elasticsearch

Spring Data implementation for ElasticSearch
63 stars 26 forks source link

Dynamic Mapping Support #5

Closed mohsinh closed 11 years ago

mohsinh commented 11 years ago

Spring Data Elasticsearch should automatically create mapping if it is not created for given entity.

e.g

public class Book{
    @Id
    private String id;
    @Field(type="string",analyzer="keyword")
    private String keywords;

}
rizwanidrees commented 11 years ago

Added support for Dynamic Mapping in cae34e50986ba3d1c58f7634da1e88202de409eb

e.g using ElasticsearchTemplate

@Document(indexName = "test-mapping", type = "mapping")
public class SampleMappingEntity {

@Id
private String id;
@Field(type = "string",index = "not_analyzed", store = true, searchAnalyzer = "standard", indexAnalyzer = "standard")
private String message;
//... getters and setters .. 

}

elasticsearchTemplate.putMapping(entity);