Add support for pagination and return_terms in 2i queries