It have 4 stages you dont need all of them:
- getInputData(context)
(here you do a search with the things you need)
- map(context)
(here you apply conditions to that search if you need to...)
- reduce(context)
(Here the script used key/value that got from map)
- summarize(summary)
(Once here is done...)
Second and third stages work as iterator(loops) base on each result coming from first Stage...