Skip to content

add how to transfer data between indices #4

Description

@VladimirFokow
def transfer_data_to_index(es, ms1, ms2):
    """
    Transfer data from index 'index1' to index 'index2'
    between the timestamps `ms1` and `ms2`.
    """
    body = {
        "source": {
            "index": "index1",
            "query": {
                "range": {
                    "timestamp": {
                        "gte": ms1,
                        "lte": ms2
                    }
                }
            }
        },
        "dest": {
            "index": "index2"
        }
    }
    return es.reindex(body, refresh=True)  
    # `refresh` reindexes the index immediately, so that it can be 
    # queried and the new data will be accessible right away.

link: https://github.com/LisaHJung/Part-4-Running-Aggregations-with-Elasticsearch-and-Kibana#set-up-data-within-elasticsearch

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions