I have a several hundred daily indexes indexed under versions 5 and 6. I have recently upgraded to 7.10 and now want to clean up and standardise my index mappings.
I am attempting to reindex using a ruby program and the gem : elasticsearch-extensions-0.0.31
def do_reindex( name = nil, new_name = nil)
name ||= @name
new_name ||= @options[:new_name]
reindex = Elasticsearch::Extensions::Reindex.new source: { index: name, client: @client }, target: { index: new_name }
reindex.perform
end
this results in output to stderr:
warning: 299 Elasticsearch-7.10.0-51e9d6f22758d0374a0f3f5c6e8f3a7997850f96 "[types removal] Specifying types in bulk requests is deprecated."
the reindex perform returns: {:errors=>120853}
, i.e one for each doc in the original index.
and in the cluster logs we see:
[2020-11-29T12:31:47,239][INFO ][o.e.a.b.TransportShardBulkAction] [secesprd02] [authentication_2019.09.02][1] mapping update rejected by primary
java.lang.IllegalArgumentException: mapper [event_source] cannot be changed from type [keyword] to [text]
at org.elasticsearch.index.mapper.ParametrizedFieldMapper.merge(ParametrizedFieldMapper.java:90) ~[elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.index.mapper.ParametrizedFieldMapper.merge(ParametrizedFieldMapper.java:61) ~[elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.index.mapper.ObjectMapper.doMerge(ObjectMapper.java:535) ~[elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.index.mapper.RootObjectMapper.doMerge(RootObjectMapper.java:298) ~[elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.index.mapper.ObjectMapper.merge(ObjectMapper.java:495) ~[elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.index.mapper.RootObjectMapper.merge(RootObjectMapper.java:293) ~[elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.index.mapper.Mapping.merge(Mapping.java:110) ~[elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.index.mapper.DocumentMapper.merge(DocumentMapper.java:281) ~[elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.index.mapper.MapperService.internalMerge(MapperService.java:470) ~[elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.index.mapper.MapperService.internalMerge(MapperService.java:421) ~[elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:361) ~[elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.action.bulk.TransportShardBulkAction.executeBulkItemRequest(TransportShardBulkAction.java:292) [elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.action.bulk.TransportShardBulkAction$2.doRun(TransportShardBulkAction.java:175) [elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.action.bulk.TransportShardBulkAction.performOnPrimary(TransportShardBulkAction.java:220) [elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.action.bulk.TransportShardBulkAction.dispatchedShardOperationOnPrimary(TransportShardBulkAction.java:126) [elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.action.bulk.TransportShardBulkAction.dispatchedShardOperationOnPrimary(TransportShardBulkAction.java:85) [elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.action.support.replication.TransportWriteAction$1.doRun(TransportWriteAction.java:179) [elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:737) [elasticsearch-7.10.0.jar:7.10.0]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-7.10.0.jar:7.10.0]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) [?:?]
at java.lang.Thread.run(Thread.java:832) [?:?]
since upgrading to 7.10 the mapping of the source index shows:
{
"authx_2019.09.02": {
"mappings": {
"properties": {
i.e. no type
and I don't give any type in the reindex.
What am I doing wrong?