I want to ask if it is possible to use spring-data-elasticsearch in conjonction with Mysql Database. For example the store of items will be with this flow elastic-search <==> spring-data <==> Mysql Database
2 Answers
My solution is, define the entity as document like:
@Entity
@Table(name = "user")
@Document(indexName = "user")
public class User {....}
Define a UserRepository of spring-data, and a UserSearchRepository of spring-data-elasticSearch separately.
When I create a new user, add index with UserSearchRepository.save(user) at the same time. Do the same when update or delete.