I want to avoid reindexing all documents after a field mapping being changed from (excerpt from the template file):
"subject": {
"type": "string"
},
to:
"subject": {
"type": "string",
"fields": {
"sort": {
"type": "string",
"analyzer": "ducet_sort_subject"
},
"sortConversation": {
"type": "string",
"analyzer": "ducet_sort_subject_conversation"
}
}
},
my java code latest version is the following:
PutMappingResponse putMappingResponse = client.admin().indices().preparePutMapping(indexName)
.setSource("{\"properties\": {}}").setType("email").execute().actionGet();
BulkIndexByScrollResponse bulkIndexByScrollResponse = INSTANCE.newRequestBuilder(client).source(indexName).get();
Please note that there is no unmappedType default, so if the mapping is not found, I'm expecting to see some error, (as it does without these new lines). Instead I get the results back also for unindexed documents, but the order is random.
I have also tried to add the mapping manually in the setSource above, but result didn't change.
In the documentation I read two statements that seem to be contrasting:
"The simplest usage of _update_by_query just performs an update on every document in the index without changing the source. This is useful to pick up a new property or some other online mapping change."
and
"Templates are only applied at index creation time. Changing a template will have no impact on existing indices. When using the create index API, the settings/mappings defined as part of the create index call will take precedence over any matching settings/mappings defined in the template."
is it even possible to do what I want without reindexing?