def sort(self, *keys):
    '\n        Add sorting information to the search request. If called without\n        arguments it will remove all sort requirements. Otherwise it will\n        replace them. Acceptable arguments are::\n\n            \'some.field\'\n            \'-some.other.field\'\n            {\'different.field\': {\'any\': \'dict\'}}\n\n        so for example::\n\n            s = Search().sort(\n                \'category\',\n                \'-title\',\n                {"price" : {"order" : "asc", "mode" : "avg"}}\n            )\n\n        will sort by ``category``, ``title`` (in descending order) and\n        ``price`` in ascending order using the ``avg`` mode.\n\n        The API returns a copy of the Search object and can thus be chained.\n        '
    s = self._clone()
    s._sort = []
    for k in keys:
        if (isinstance(k, string_types) and k.startswith('-')):
            if (k[1:] == '_score'):
                raise IllegalOperation('Sorting by `-_score` is not allowed.')
            k = {k[1:]: {'order': 'desc'}}
        s._sort.append(k)
    return s
Add sorting information to the search request. If called without
arguments it will remove all sort requirements. Otherwise it will
replace them. Acceptable arguments are::

    'some.field'
    '-some.other.field'
    {'different.field': {'any': 'dict'}}

so for example::

    s = Search().sort(
        'category',
        '-title',
        {"price" : {"order" : "asc", "mode" : "avg"}}
    )

will sort by ``category``, ``title`` (in descending order) and
``price`` in ascending order using the ``avg`` mode.

The API returns a copy of the Search object and can thus be chained.
def sort(self, *keys):
    '\n        Add sorting information to the search request. If called without\n        arguments it will remove all sort requirements. Otherwise it will\n        replace them. Acceptable arguments are::\n\n            \'some.field\'\n            \'-some.other.field\'\n            {\'different.field\': {\'any\': \'dict\'}}\n\n        so for example::\n\n            s = Search().sort(\n                \'category\',\n                \'-title\',\n                {"price" : {"order" : "asc", "mode" : "avg"}}\n            )\n\n        will sort by ``category``, ``title`` (in descending order) and\n        ``price`` in ascending order using the ``avg`` mode.\n\n        The API returns a copy of the Search object and can thus be chained.\n        '
    s = self._clone()
    s._sort = []
    for k in keys:
        if (isinstance(k, string_types) and k.startswith('-')):
            if (k[1:] == '_score'):
                raise IllegalOperation('Sorting by `-_score` is not allowed.')
            k = {k[1:]: {'order': 'desc'}}
        s._sort.append(k)
    return s