简体   繁体   中英

What happens to the data in the original index after reindexing in elasticsearch?

In an elasticsearch instance, I have data in an index "a". I want to copy all data within a period (say Aug 2021 to September 2021) to another index "b". I apply reindex in the following manner:

POST _reindex
{
    "source": {
        "index": "a",
            "query": {
                    "range": {
                        "created": {
                            "gte": "2021-08-01 00:00:00.000",
                            "lt": "2021-09-01 00:00:00.000"
                            }
                        }
                    }
        },
    "dest": {
            "index": "b"
        }  
}

Now, if I decide to delete the index "b", what happens to the data that I just moved? Does it still stay in index "a"?

Yes, the reindex operation leaves the source index untouched. After the reindex is done, you have two indexes a and b and you can decide to do whatever you want with them.

If you're happy with the data in index b you can decide to remove index a , if you're not, you can delete b , keep a and re-attempt another reindex.

It's up to you to do whatever you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM