Is it possible to delete a single mapping type from an index without deleting the entire index? https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-mapping.html says that this is not longer possible but I find this hard to believe. Can anyone explain why the functionality was removed? Seems like basic stuff.
I have an index with two mappings. I would like to be able to remove one mapping type (along with all documents of that type) without removing the other mapping type.
Thanks
An example of potential problem with deleting types/mapping and the explanation for disabling can be found in elasticsearch issue : 8877. Extract from issue description :
Currently reindex is the only option however to alleviate the problem of reindexing on client end seems like there maybe a possiblity of support for reindex api in future : see issue:16207 and issue:#15201 for more details.
For latest version(above 2.0) of ES, It is no longer possible to delete the mapping for a type. Instead you should delete the index and recreate it with the new mappings. For more information you can see this in official document here. For the older versions(Below 2.0) of elasticsearch allow to delete a mapping (type) along with its data. The REST endpoints are
To answer your question, I believe it was yanked out for reliability and maybe performance optimizations when the mappings get shipped around the cluster.
The reason why it's hard to change anything in ES index is because the underlying storage is an inverted index, and any data that you have put in has been already indexed with those mapping rules.
Elasticsearch lowers the barrier of entry into search, but has some pretty complicated stuff going under the hood.
I know its a bummer
But that is why we have aliases
While querying we use them
While indexing, you can create an index_2, put new mapping, populate it fully using some batch method
Then change alias from index_1 to index_2