Build new query from a script

I want to know if a new query can be started from a script. I need to build
a new query from the _source field of a limited number hits of the initial
filtered query. Is this possible? If so, an example
would help a lot.

Thanks
Kennedy

--