My data dates are in the epoch format thus I am trying to use mapping to display the date in the proper format in Kibana, however, it's failing with the following error message:
[2020-09-10T18:39:43,718][INFO ][o.e.a.b.TransportShardBulkAction] [tx-kibana] [fscd-flat-2020-09-05][0] mapping update rejected by primary
java.lang.IllegalArgumentException: mapper [UploadTimestamp] cannot be changed from type [date] to [text]
This error message is saying one thing, but your question is saying something different. Can you please be more specific about:
What have you tried so far?
What were you expecting to happen?
In particular, you need to explain whether you already have documents indexed, whether you already have an index template, and what the timestamps you have look like
In Kibana I am getting the expected data but the date field called 'UploadTimestamp' is displaying in epoch format - the expected format is similar to this (Kibana 6)
This is my date configuration in Kibana:
[2020-09-10T20:10:24,298][INFO ][o.e.a.b.TransportShardBulkAction] [tx-kibana] [fscd-flat-2020-09-08][0] mapping update rejected by primary
java.lang.IllegalArgumentException: mapper [UploadTimestamp] cannot be changed from type [date] to [text]
at org.elasticsearch.index.mapper.FieldMapper.mergeSharedOptions(FieldMapper.java:322) ~[elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.index.mapper.FieldMapper.merge(FieldMapper.java:304) ~[elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.index.mapper.FieldMapper.merge(FieldMapper.java:50) ~[elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.index.mapper.ObjectMapper.doMerge(ObjectMapper.java:529) ~[elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.index.mapper.RootObjectMapper.doMerge(RootObjectMapper.java:296) ~[elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.index.mapper.ObjectMapper.merge(ObjectMapper.java:489) ~[elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.index.mapper.RootObjectMapper.merge(RootObjectMapper.java:291) ~[elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.index.mapper.Mapping.merge(Mapping.java:99) ~[elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.index.mapper.DocumentMapper.merge(DocumentMapper.java:320) ~[elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.index.mapper.MapperService.internalMerge(MapperService.java:480) ~[elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.index.mapper.MapperService.internalMerge(MapperService.java:427) ~[elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:359) ~[elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.action.bulk.TransportShardBulkAction.executeBulkItemRequest(TransportShardBulkAction.java:281) [elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.action.bulk.TransportShardBulkAction$2.doRun(TransportShardBulkAction.java:164) [elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.action.bulk.TransportShardBulkAction.performOnPrimary(TransportShardBulkAction.java:209) [elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.action.bulk.TransportShardBulkAction.dispatchedShardOperationOnPrimary(TransportShardBulkAction.java:116) [elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.action.bulk.TransportShardBulkAction.dispatchedShardOperationOnPrimary(TransportShardBulkAction.java:82) [elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.action.support.replication.TransportWriteAction$1.doRun(TransportWriteAction.java:161) [elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:710) [elasticsearch-7.9.1.jar:7.9.1]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-7.9.1.jar:7.9.1]
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) [?:?]
Date formats in Kibana are complete separate from date formats in the mappings of your Elasticsearch index. You are seeing Elasticsearch errors, not Kibana errors. The number you're showing me is not in the standard epoch_millis format, it's in epoch_seconds format. Take a look at the documentation here: https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html
Thanks @wylie for your prompt responses but it seems that I am still missing something:
So I ran the following command in Kibana but did not resolve the issue:
The information you've shared so far doesn't help me to understand where the issue is happening. Please share an example date that you are trying to store in Elasticsearch, and let's go from there.
That error message is pretty clear to me: one of your indices is in a bad state, so try out the reindex method I showed above to create a copy with the correct mappings
You're are correct, when I reindex it and delete the 'bad' index the issue goes away. is there a way to make it automated? The same data goes to Kibana 6 (configured previously by another team) and there is no issue there.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.