'Returns a page object.
This class overrides the default behavior and ignores "orphans" and
assigns the count from the ES result to the Paginator.'

def page(self, number):

    number = self.validate_number(number)
    bottom = ((number - 1) * self.per_page)
    top = (bottom + self.per_page)
    result = self.object_list[bottom:top].execute()
    page = Page(result.hits, number, self)
    self._count = page.object_list.total
    page.aggregations = getattr(result, 'aggregations', None)
    if (number > self.num_pages):
        if ((number == 1) and self.allow_empty_first_page):
            pass
        else:
            raise EmptyPage('That    page    contains    no    results')
    return page
