Mapping ElasticSearch results to JPA Entities using JEST Mapping ElasticSearch results to JPA Entities using JEST elasticsearch elasticsearch

Mapping ElasticSearch results to JPA Entities using JEST


You can use Spring Data Elasticsearch it work with JPA together..

@Configuration@EnableTransactionManagement@EnableJpaRepositories(excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = ElasticsearchCrudRepository.class))@EnableElasticsearchRepositories(includeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = ElasticsearchCrudRepository.class))public class DataConfiguration {    ...}

Entity Example:

@Entity@Table(name="learn_author")@Document(indexName = "blogging", type = "author", shards = 1, replicas = 0)public class Author implements Serializable {    @org.springframework.data.annotation.Id    @Id    @GeneratedValue(strategy= GenerationType.SEQUENCE)    @Column(name="id")    private Long id;    @Column(name="username")    private String username;    @Field(type = FieldType.String,        searchAnalyzer = "standard",        indexAnalyzer = "standard",        store = true)    @Column(name="fullname")    private String fullname;    ...}

click here for full example