I'm working on a SAAS project which includes more than 50 microservices. We've implemented per microservice per database pattern. Some of the listing UI components are very complex which includes filters, sorting and pagination. These lists can't be retrieved via API composition because bulk queries will be huge.
We are developing VIEWS (ELASTICSEARCH Indexes, MONGO Collections) which are subscribed to domain events.
Eveytime we need to build views thinking about should we make local copies of entites in view database or makes synchronous call to a service when the event comes. Of course, in the second case the availability is lower (maybe still high for our system) but it avoids extra data managment.
Imagine VIEW needs something like orderId, userId, username and OrderCreated event only contains userId:
What if we only store userId and will aggregate username when customer makes a call to my API (It will avoid storing local copy or making external call on command-side) but what if username is searchable ?
If we make a view, should we try to store the maximum fields to avoid aggregations from BFF to core services and otherwise implementing such kind of VIEWS won't be as effecient and it's overkill ?
I know the choice often depends on specific system requirements but can somebody explain what's the key points which needs to be considered before choose one the design pattern