in elasticsearch/dsl/search_base.py [0:0]
def index(self, *index: Union[str, List[str], Tuple[str, ...]]) -> Self:
"""
Set the index for the search. If called empty it will remove all information.
Example::
s = Search()
s = s.index('twitter-2015.01.01', 'twitter-2015.01.02')
s = s.index(['twitter-2015.01.01', 'twitter-2015.01.02'])
"""
# .index() resets
s = self._clone()
if not index:
s._index = None
else:
indexes = []
for i in index:
if isinstance(i, str):
indexes.append(i)
elif isinstance(i, list):
indexes += i
elif isinstance(i, tuple):
indexes += list(i)
s._index = (self._index or []) + indexes
return s