Hi I have a question related with optimization, I have a page lets call it global page that haves N components on each.
Each component will perform an elasticsearch query that is going to be composed of two parts
- Query is set at global page level
- Aggregation is created by the component.
The current way of things make each component to generate a full query using the global page generated query and the component's aggregation. Which results in the global page making >= N requests all of them using the same query.
The requests have size=0 encouraging caching of the aggregated results and that didn't resulted since the cache key is the full query json and it won't work when it changes. I wonder if there is a way to improve this.
I was looking solutions like locking results but so far I have found none.
I also tried running a prep query fetching the document ids and then aggregating on each component over a query matching the ids with the specific aggregation but since we have too many documents for some cases the payload can get pretty big since the ids are long strings.
Any advice?