parameters: (self, *keys)
return_statement: return s
docstring: 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.
docstring_summary: 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::
docstring_tokens: 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 ::
function: def sort(self, *keys):
          """
          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.
          """
          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
function_tokens: def sort ( self , * keys ) : 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