What is the correct way to support Global search across multiple document types?

Let's say in a Microservices architecture there are 100s of different entities and search needs to be supported that can look for matches in all those entities. I see a few ways of doing this.

  1. Create one index for each entity - make as many search queries as number of indexes in parallel and then merge the results.
  2. Create multiple really wide indexes ( going all the way to max allowed columns in an index). Create multiple such indexes as need. Do same as 1 for these indexes.
  3. Add only a limited number of pre-defined columns that are common to all entities. Add one more column like "searchableData" that holds data from other entity fields but not the file names. This means that all fields from individual entities are not provided as "filters" but their data is indexed and can be searched. This is not ideal but seems like a reasonable solution.

Any suggestions?

100s of different entities? Sounds like a misconception. Maybe it's possible to "normalize" them.

Well, what if there are that many different denormalized objects in a system? It can be a huge system depending on the business domain. Consider something like Salesforce that lets customers even create custom objects.

Let's say 100 is exaggerated, what is good way to go for say 25 such already denormalized objects?

I'd go for one index per type of entity.

Then you can search across all the indices if needed.

If you can have some common fields (like metadata) that'd probably be helpful as well.

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