diff --git a/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java b/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java index 7663ec817a0db..6424e75eaf662 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java @@ -109,10 +109,11 @@ public enum MergeReason { //TODO this needs to be cleaned up: _timestamp and _ttl are not supported anymore, _field_names, _seq_no, _version and _source are //also missing, not sure if on purpose. See IndicesModule#getMetadataMappers - private static ObjectHashSet META_FIELDS = ObjectHashSet.from( - "_id", "_type", "_routing", "_index", - "_size", "_timestamp", "_ttl", IgnoredFieldMapper.NAME - ); + private static final String[] SORTED_META_FIELDS = new String[]{ + "_id", IgnoredFieldMapper.NAME, "_index", "_routing", "_size", "_timestamp", "_ttl", "_type" + }; + + private static final ObjectHashSet META_FIELDS = ObjectHashSet.from(SORTED_META_FIELDS); private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(MapperService.class)); @@ -762,7 +763,7 @@ public static boolean isMetadataField(String fieldName) { } public static String[] getAllMetaFields() { - return META_FIELDS.toArray(String.class); + return Arrays.copyOf(SORTED_META_FIELDS, SORTED_META_FIELDS.length); } /** An analyzer wrapper that can lookup fields within the index mappings */ @@ -789,5 +790,4 @@ protected Analyzer getWrappedAnalyzer(String fieldName) { return defaultAnalyzer; } } - }