Batching the query example with looping

Can someone help with example. How to do batching in Query.

I have clear understanding of how it works but need clarity while implementing.

 Eg: create a query entity rule such as : a!queryEntity(entity: cons!entity, query: a!query(filters{whatever filters you want},
local!pagingInfo(startIndex: 1, batchSize: 100)
))

after this what i need to do?

I need to fetch 7000 records

  Discussion posts and replies are publicly visible