'GraphQL with ElasticSearch and multiple indexes

I am new to GraphQL and have few questions on usage with ElasticSearch. It may not be right platform to ask as it is more like design question. But any pointers to my questions will surely help me to progress.

We are using ElasticSearch as DB with data spread across multiple indexes. As we evolve with more scenarios, running into cases like joining data like SQL between different indexes. ElasticSearch supports joins only in same index and with a condition on sharding. Hence we ended up having more APIs and data massage after querying the data which is hitting our overall performance of application.

From GraphQL, I believe this problem can be addressed to some extent using federated GraphQL server like Apollo.

Please suggest if my understanding is correct. Are there any best practices to use GraphQL with ElasticSearch and search across multiple indexes.

Thank you in advance



Solution 1:[1]

That's definitely true about the federated schema with Apollo but maybe you're abusing the tool aswell, you can tell better obviously, but couldn't you use any other DB for that use and then load it with elastic indexes if needed? Elastic is a great tool but it is a memory tool, you can't have it both ways i'm afraid, loading it will require enormous memory from the server, memory that with a good enough state management might not be needed from the initialization of the web app therefore the user wont have to use all those resources that you now use.

That is always debatable and because its your use case you know what's best but overloading elastic is a classic as i'm sure you've seen from other cases.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 adtoctor