Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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"?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading