def source(self, fields=None, **kwargs):
    '\n        Selectively control how the _source field is returned.\n\n        :arg fields: wildcard string, array of wildcards, or dictionary of includes and excludes\n\n        If ``fields`` is None, the entire document will be returned for\n        each hit.  If fields is a dictionary with keys of \'includes\' and/or\n        \'excludes\' the fields will be either included or excluded appropriately.\n\n        Calling this multiple times with the same named parameter will override the\n        previous values with the new ones.\n\n        Example::\n\n            s = Search()\n            s = s.source(includes=[\'obj1.*\'], excludes=["*.description"])\n\n            s = Search()\n            s = s.source(includes=[\'obj1.*\']).source(excludes=["*.description"])\n\n        '
    s = self._clone()
    if (fields and kwargs):
        raise ValueError('You cannot specify fields and kwargs at the same time.')
    if (fields is not None):
        s._source = fields
        return s
    if (kwargs and (not isinstance(s._source, dict))):
        s._source = {}
    for (key, value) in kwargs.items():
        if (value is None):
            try:
                del s._source[key]
            except KeyError:
                pass
        else:
            s._source[key] = value
    return s
Selectively control how the _source field is returned.

:arg fields: wildcard string, array of wildcards, or dictionary of includes and excludes

If ``fields`` is None, the entire document will be returned for
each hit.  If fields is a dictionary with keys of 'includes' and/or
'excludes' the fields will be either included or excluded appropriately.

Calling this multiple times with the same named parameter will override the
previous values with the new ones.

Example::

    s = Search()
    s = s.source(includes=['obj1.*'], excludes=["*.description"])

    s = Search()
    s = s.source(includes=['obj1.*']).source(excludes=["*.description"])
def source(self, fields=None, **kwargs):
    '\n        Selectively control how the _source field is returned.\n\n        :arg fields: wildcard string, array of wildcards, or dictionary of includes and excludes\n\n        If ``fields`` is None, the entire document will be returned for\n        each hit.  If fields is a dictionary with keys of \'includes\' and/or\n        \'excludes\' the fields will be either included or excluded appropriately.\n\n        Calling this multiple times with the same named parameter will override the\n        previous values with the new ones.\n\n        Example::\n\n            s = Search()\n            s = s.source(includes=[\'obj1.*\'], excludes=["*.description"])\n\n            s = Search()\n            s = s.source(includes=[\'obj1.*\']).source(excludes=["*.description"])\n\n        '
    s = self._clone()
    if (fields and kwargs):
        raise ValueError('You cannot specify fields and kwargs at the same time.')
    if (fields is not None):
        s._source = fields
        return s
    if (kwargs and (not isinstance(s._source, dict))):
        s._source = {}
    for (key, value) in kwargs.items():
        if (value is None):
            try:
                del s._source[key]
            except KeyError:
                pass
        else:
            s._source[key] = value
    return s