I am trying to figure out an approach to delete all entries for a specific property in an elasticsearch index and remove all type mappings for that property.
I have been looking at the following two doc pages: put mapping and delete mapping
From second link:
"Allow to delete a mapping (type) along with its data. The REST endpoint is /{index}/{type} with DELETE method."
What I think I need is a /{index}/{type}/{property}
?
Do I need to recreate the whole index to accomplish this, i.e. moving and manipulating data between types?
For Example, calling GET on the mapping:
curl -XGET 'http://.../some_index/some_type/_mapping'
result:
{ "some_type": { "properties": { "propVal1": { "type": "double", "index": "analyzed" }, "propVal2": { "type": "string", "analyzer": "keyword" }, "propVal3": { "type": "string", "analyzer": "keyword" } } } }
after this delete operation on propVal3
would return:
curl -XGET 'http://.../some_index/some_type/_mapping'
result:
{ "some_type": { "properties": { "propVal1": { "type": "double", "index": "analyzed" }, "propVal2": { "type": "string", "analyzer": "keyword" } } } }
and all data for propVal3
would be removed through the index.
You cannot delete the status field from this mapping. If you really need to get rid of this field, you'll have to create another mapping without status field and reindex your data.
It's not currently possible to remove a property from a mapping. In order to remove all values of a property from all records, you need to reindex all records with this property removed.
You can use the update mapping API to add new properties to an existing object field. To see how this works, try the following example. Use the create index API to create an index with the name object field and an inner first text field. Use the update mapping API to add a new inner last text field to the name field.
You use DELETE to remove a document from an index. You must specify the index name and document ID. You cannot send deletion requests directly to a data stream. To delete a document in a data stream, you must target the backing index containing the document.
You can not do that. Just forget that this value exists... ;-) If you really need to remove it, you will have to reindex your documents.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With