2

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 2

5

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.

Sign up to request clarification or add additional context in comments.

Comments

0

No You can not use Spring Data Elasticsearch to do your database operations on MySQL. The name itself states that this Spring Data Technology is an implementation for the Elasticsearch. To do the Database part you will require a Java persistence technology(eg. Hibernate)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.