Elasticsearch in microservices architecture, design question [closed] Elasticsearch in microservices architecture, design question [closed] elasticsearch elasticsearch

Elasticsearch in microservices architecture, design question [closed]


Another search service would be overly abstracting it.

What I would do:

  1. Use Xpack Security RBAC, which is now free, to lock down the indices for each micro service to an account that the service is configured to use: https://www.elastic.co/blog/security-for-elasticsearch-is-now-free
  2. Use search templates in Elasticsearch to abstract out the search logic from the services, to ES, then have the services call the templates.


I would go with a separate Search service. There are several reasons for that.

  1. It's another (business) process so you can be more flexible. Let's say you might have CustomerMasterData service and CustomerAddress service. But search requirements are to be able to search either by customer name or by address. Having two different Servers/ES indexes will not make you life easier. However in case of separate search service you can actually build index that holds data from different sources.

  2. Service should own data. It means that Search should be the only service that has access to the ES index directly.

  3. Filling ES index could be separated and done via communication to another service. I would do it via messaging system. For instance Search service sends Sync request and other services that listen to the queue will send out data. It allows to keep things independent.