Flow of sorting/aggrgation

Hi Can any one share the flow of sorting/aggrgation flow how the request is processed in elasticsearch

for example

user request->ES->sort of particular field of a type -> output

data from disk is loaded from disk to memory and sorted and result is given to end user

which cache will be used during sorting... query cache or field data cache or heapsize

Regards

Justin

To better understand the flow of sorting and aggregations, you should first cover the basics of how the flow of query is executed.
This link will help in that: https://www.elastic.co/guide/en/elasticsearch/guide/current/distributed-search.html

After you have covered that, we will be able to understand how in the query phase, ElasticSearch will get to know which documents (after sorting and pagination) to fetch and then fetch them in the fetch phase.

You will also benefit from covering some of the basics of how the in-memory structures are created/maintained (I am talking about inverted indices vs field data here). That will cover how the documents are targeted during aggregations. Please read this: https://www.elastic.co/guide/en/elasticsearch/guide/current/fielddata-intro.html