From 4edc92d4140ba6fe3859768dac6fdbe2e80afbc4 Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Wed, 22 Jun 2016 19:45:36 +0200 Subject: [PATCH] Add deprecation logging for `_timestamp` and `_ttl`. #19031 --- .../org/elasticsearch/index/mapper/MapperService.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/src/main/java/org/elasticsearch/index/mapper/MapperService.java b/core/src/main/java/org/elasticsearch/index/mapper/MapperService.java index baa3be98a39a1..02a000764d42c 100755 --- a/core/src/main/java/org/elasticsearch/index/mapper/MapperService.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/MapperService.java @@ -348,6 +348,16 @@ private synchronized DocumentMapper merge(DocumentMapper mapper, MergeReason rea logger.warn("Type [{}] starts with a '.', it is recommended not to start a type name with a '.'", mapper.type()); } } + if (reason == MergeReason.MAPPING_UPDATE) { + if (mapper.timestampFieldMapper().enabled()) { + deprecationLogger.deprecated("[_timestamp] will be removed in 5.0. As a replacement, you should explicitly populate a date " + + "field with the current timestamp in your documents."); + } + if (mapper.TTLFieldMapper().enabled()) { + deprecationLogger.deprecated("[_ttl] will be removed in 5.0. As a replacement, you should use time based indexes or cron " + + "a delete-by-query with a range query on a timestamp field."); + } + } // 1. compute the merged DocumentMapper DocumentMapper oldMapper = mappers.get(mapper.type());