def serialize(self):
        if not self.field:
            raise InvalidSortOrder('sort order must contain field name')

        return {self.field: self.serialize_order_params()}
Serialize the search to a structure as passed for a search body.
dataset/ETHPy150Open aparo/pyes/pyes/sort.py/SortOrder.serialize