public Builder(IndexMetaData indexMetaData) { this(indexMetaData.index()); settings(indexMetaData.settings()); mappings.putAll(indexMetaData.mappings); aliases.putAll(indexMetaData.aliases); customs.putAll(indexMetaData.customs); this.state = indexMetaData.state; this.version = indexMetaData.version; }
public Builder(IndexTemplateMetaData indexTemplateMetaData) { this(indexTemplateMetaData.name()); order(indexTemplateMetaData.order()); template(indexTemplateMetaData.template()); settings(indexTemplateMetaData.settings()); mappings.putAll(indexTemplateMetaData.mappings()); }
public IndexMetaData build() { MapBuilder<String, AliasMetaData> tmpAliases = aliases; Settings tmpSettings = settings; // For backward compatibility String[] legacyAliases = settings.getAsArray("index.aliases"); if (legacyAliases.length > 0) { tmpAliases = MapBuilder.newMapBuilder(); for (String alias : legacyAliases) { AliasMetaData aliasMd = AliasMetaData.newAliasMetaDataBuilder(alias).build(); tmpAliases.put(alias, aliasMd); } tmpAliases.putAll(aliases.immutableMap()); // Remove index.aliases from settings once they are migrated to the new data structure tmpSettings = ImmutableSettings.settingsBuilder().put(settings).putArray("index.aliases").build(); } // update default mapping on the MappingMetaData if (mappings.containsKey(MapperService.DEFAULT_MAPPING)) { MappingMetaData defaultMapping = mappings.get(MapperService.DEFAULT_MAPPING); for (MappingMetaData mappingMetaData : mappings.map().values()) { mappingMetaData.updateDefaultMapping(defaultMapping); } } return new IndexMetaData( index, version, state, tmpSettings, mappings.immutableMap(), tmpAliases.immutableMap(), customs.immutableMap()); }