Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elasticsearch Delete Mapping Property

Tags:

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.

like image 466
Ryan R. Avatar asked Apr 22 '13 20:04

Ryan R.


People also ask

How do I remove a mapping field in Elasticsearch?

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.

How do I delete a property in Elasticsearch?

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.

How do I update mappings in Elasticsearch?

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.

How do I remove something from Elasticsearch?

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.


1 Answers

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.

like image 124
dadoonet Avatar answered Sep 20 '22 11:09

dadoonet