Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting a mapping should not delete data #10430

Closed
shivangshah opened this issue Apr 4, 2015 · 8 comments
Closed

Deleting a mapping should not delete data #10430

shivangshah opened this issue Apr 4, 2015 · 8 comments

Comments

@shivangshah
Copy link

Hi,

I am just deleting the mapping so that I can recreate the mapping with different core types for some fields (especially when "updating a mapping type" doesn't really do much good on changing core types at all). And even if we don't care about the past data that does not mean it should just delete the data. At the very least this should be more of a configurable option rather than an internal clean up in elastic search. I do not want to go about reindexing all my data just because I changed a core type. I just want to keep the past data as document storage and somehow mark them as "old data". But if I delete and recreate the mapping, I don't even have a choice to do that because the corresponding documents will be deleted!

@clintongormley
Copy link
Contributor

HI @shivangshah

The ability to delete a mapping has been removed in master (see #8877). If you need to change the mapping, you need to reindex.

@shivangshah
Copy link
Author

@clintongormley but how do we update the mapping if there is no "delete" ? I understand the reindexing part. Right now if you don't delete and recreate you cannot update the core mapping of a field. How can you do it in master now?

@clintongormley
Copy link
Contributor

@shivangshah you can't. you have to reindex. changing a mapping means that your existing indexed data will now be incorrect. the only way to correct that data is to reindex it all.

@shivangshah
Copy link
Author

@clintongormley So basically you can't delete, you can't update and you are stuck with whatever is created (by first document indexed or manually put mappings) for a given field mapping?

@clintongormley
Copy link
Contributor

correct

@shivangshah
Copy link
Author

got it .. and this will be release in v2.0 I am guessing ?

@clintongormley
Copy link
Contributor

Yes, but even with delete-mapping today, it is trappy. you can still have vestiges of old fields in old segments, even though you have deleted the mapping. So the same advice still applied: you want to change a field? reindex your data

@shivangshah
Copy link
Author

reindexing the data is not a problem. The problem is with reindexing the data in a whole different index by putting new mappings to it. That's just not a good solution. My feedback here would be let the clients update the mappings and just warn them to reindex the data .. I'd rather get all the data from the same index and reindex in the same one rather than going through the route of creating a new index, reindexing all the data there, update ALL the aliases that pointed to the old index and than drop the old index. The process is extremely cumbersome especially you know that your mappings are going to change a whole lot. I described a part of our usecase here: #8870

I still believe that instead of throttling so much at the mapping level, make it more flexible for clients but make them aware of the risks (reindexing and stuff). You will have to reindex regardless when you update the mapping. The question is which is the easiest route for a client .. And my vote goes for flexible implementation + understanding of risks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants