Hi,
I would like to delete a field from a mapping.
As I've read I can do this with reindexing the whole documents but currently however I create the new index without the removed field the reindexed documents contains that field.
How can I reindex the documents without containing the old field?
I use the following script at reindexing:
ctx._source.remove('text')
New Mapping looks like this:
{
"mapping": {
"properties": {
"id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"num1": {
"type": "long"
},
"parentfolderid": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"relation": {
"type": "join",
"eager_global_ordinals": true,
"relations": {
"root": "field"
}
},
"string1": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
I receive a response like this when I query the new documents:
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 4,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "basic_tests_d50d27468a024757ad8044c082270eed",
"_type" : "_doc",
"_id" : "0",
"_score" : 1.0,
"_source" : {
"id" : "0",
"relation" : "root",
"parentfolderid" : "549272721"
}
},
{
"_index" : "basic_tests_d50d27468a024757ad8044c082270eed",
"_type" : "_doc",
"_id" : "0_text",
"_score" : 1.0,
"_routing" : "0",
"_source" : {
"id" : "0_text",
"relation" : {
"parent" : "0",
"name" : "field"
}
}
},
{
"_index" : "basic_tests_d50d27468a024757ad8044c082270eed",
"_type" : "_doc",
"_id" : "0_string1",
"_score" : 1.0,
"_routing" : "0",
"_source" : {
"string1" : "alma_is_alma 123_456 1353917046 one two three four five six seven eight nine ten",
"id" : "0_string1",
"relation" : {
"parent" : "0",
"name" : "field"
}
}
},
{
"_index" : "basic_tests_d50d27468a024757ad8044c082270eed",
"_type" : "_doc",
"_id" : "0_num1",
"_score" : 1.0,
"_routing" : "0",
"_source" : {
"num1" : 1825286935,
"id" : "0_num1",
"relation" : {
"parent" : "0",
"name" : "field"
}
}
}
]
}
}
Thanks