def read_text(path, blocksize=None, compression='infer',
              encoding=system_encoding, errors='strict',
              linedelimiter=os.linesep, collection=True, **kwargs):
    if isinstance(path, (tuple, list, set)):
        blocks = sum([read_text(fn, blocksize=blocksize,
                      compression=compression, encoding=encoding, errors=errors,
                      linedelimiter=linedelimiter, collection=False, **kwargs)
                     for fn in path], [])
    else:
        if compression == 'infer':
            compression = infer_compression(path)

        if blocksize and compression not in seekable_files:
            raise ValueError(
                  "Compression %s does not support breaking apart files\n"
                  "Use ``blocksize=None`` or decompress file externally"
                  % compression)
        if compression not in seekable_files and compression not in cfiles:
            raise NotImplementedError("Compression format %s not installed" %
                                      compression)

        elif blocksize is None:
            files = open_text_files(path, encoding=encoding, errors=errors,
                                          compression=compression, **kwargs)
            blocks = [delayed(list)(file) for file in files]

        else:
            _, blocks = read_bytes(path, delimiter=linedelimiter.encode(),
                    blocksize=blocksize, sample=False, compression=compression,
                    **kwargs)
            if isinstance(blocks[0], (tuple, list)):
                blocks = list(concat(blocks))
            blocks = [delayed(decode)(b, encoding, errors)
                      for b in blocks]

    if not blocks:
        raise ValueError("No files found", path)

    if not collection:
        return blocks
    else:
        return from_delayed(blocks)
Query ES to get a list of indexes that actually exist.
dataset/ETHPy150Open dask/dask/dask/bag/text.py/read_text--crossover with--dataset/ETHPy150Open mozilla/kitsune/kitsune/search/es_utils.py/get_indexes