Reputation: 23247
I've updated to ElasticSearch 2.1. Deleting a mapping type is not supported anymore since 2.0 onward.
Before, it was very useful to simply remove a type, and created it again.
So, the question is waht should I do in order to reach it out on ElasticSearch 2.1?
Imagine I've an index idx
with a type tp
.
I supose I shall use alias
, however I don't know how to do it.
Does exists alias
for index-level
? Does exist alias
for type-level
?
Upvotes: 0
Views: 165
Reputation: 225
Oh,since 2.x,the elasticsearch cannot delete the mapping .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.
[You can refer to the link as follow ! ]
https://www.elastic.co/guide/en/elasticsearch/reference/2.2/indices-delete-mapping.html
Upvotes: 1
Reputation: 217314
As mentioned in my answer to your other question, you can proceed in a similar way as before, just on a totally new index (which I called myindex
below):
First create a new index with your mapping
curl -XPUT localhost:9200/myindex -d '{
"mappings": {
"mytype": {
"properties": {
...
}
}
}
}'
Then re-index your data in your new index
curl -XPUT localhost:9200/myindex/mytype/1 -d '{"field":"value"}'
Finally, you can run your queries on your new index myindex
, you can also delete the previous index:
curl -XDELETE localhost:9200/oldindex
Upvotes: 0