Integrating elastic search with existing spring boot application


(Mohab Shihab) #1

I have an under development springboot application and need to use elastic search for items search for items search

I am using spring data elastic search repository implementation

my question is what's the best practice to insert and update data at the elastic search repository

should I apply this via aspect programming or modify the business logic implementation and add the repository save function all


(David Pilato) #2

I'd modify the business logic.
An example here:

(Look at the save method).


(Mohab Shihab) #3

Thanks @dadoonet

I see many implementation the as you said, but

Doesn't this with the single responsibility principle ?
Why not selecting to implement JPA entity listener and call save at persist event or user aspect oriented programming


(David Pilato) #4

It can work. But I honestly prefer to decouple the storage logic vs the search logic.


(Mohab Shihab) #5

Thanks


(system) #6

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.