def reindex(client, source_index, target_index, query=None, target_client=None,
        chunk_size=500, scroll='5m', scan_kwargs={}, bulk_kwargs={}):
    target_client = client if target_client is None else target_client

    docs = scan(client, query=query, index=source_index, scroll=scroll, **scan_kwargs)
    def _change_doc_index(hits, index):
        for h in hits:
            h['_index'] = index
            yield h

    return bulk(target_client, _change_doc_index(docs, target_index),
        chunk_size=chunk_size, stats_only=True, **bulk_kwargs)
Override for incoming message interception.
dataset/ETHPy150Open hvandenb/splunk-elasticsearch/search-elasticsearch/bin/elasticsearch/helpers/__init__.py/reindex--crossover with--dataset/ETHPy150Open ooici/pyon/pyon/ion/endpoint.py/ProcessEndpointUnitMixin._intercept_msg_in