public IndexMetaData getMetaData() { return indexSettings.getIndexMetaData(); }
IndexMetaData getIndexMetaData() { return shard.indexSettings.getIndexMetaData(); }
private void checkPartitionedIndexConstraints(DocumentMapper newMapper) { if (indexSettings.getIndexMetaData().isRoutingPartitionedIndex()) { if (newMapper.parentFieldMapper().active()) { throw new IllegalArgumentException("mapping type name [" + newMapper.type() + "] cannot have a " + "_parent field for the partitioned index [" + indexSettings.getIndex().getName() + "]"); } if (!newMapper.routingFieldMapper().required()) { throw new IllegalArgumentException("mapping type [" + newMapper.type() + "] must have routing " + "required for partitioned index [" + indexSettings.getIndex().getName() + "]"); } } }
shards.stream().mapToLong(LocalShardSnapshot::maxUnsafeAutoIdTimestamp).max().getAsLong(); addIndices(indexShard.recoveryState().getIndex(), directory, indexSort, sources, maxSeqNo, maxUnsafeAutoIdTimestamp, indexShard.indexSettings().getIndexMetaData(), indexShard.shardId().id(), isSplit, hasNested); internalRecoverFromStore(indexShard);
IndexMetaData getIndexMetaData() { return shard.indexSettings.getIndexMetaData(); }
public IndexMetaData getMetaData() { return indexSettings.getIndexMetaData(); }
IndexMetaData getIndexMetaData() { return shard.indexSettings.getIndexMetaData(); }
break; case LOCAL_SHARDS: final IndexMetaData indexMetaData = indexSettings().getIndexMetaData(); final Index resizeSourceIndex = indexMetaData.getResizeSourceIndex(); final List<IndexShard> startedShards = new ArrayList<>();
pendingPrimaryTerm = indexSettings.getIndexMetaData().primaryTerm(shardId.id()); operationPrimaryTerm = pendingPrimaryTerm; refreshListeners = buildRefreshListeners();
private boolean isTranslogClean(ShardPath shardPath, String translogUUID) throws IOException { // perform clean check of translog instead of corrupted marker file boolean clean = true; try { final Path translogPath = shardPath.resolveTranslog(); final long translogGlobalCheckpoint = Translog.readGlobalCheckpoint(translogPath, translogUUID); final IndexMetaData indexMetaData = IndexMetaData.FORMAT.loadLatestState(logger, namedXContentRegistry, shardPath.getDataPath().getParent()); final IndexSettings indexSettings = new IndexSettings(indexMetaData, Settings.EMPTY); final TranslogConfig translogConfig = new TranslogConfig(shardPath.getShardId(), translogPath, indexSettings, BigArrays.NON_RECYCLING_INSTANCE); long primaryTerm = indexSettings.getIndexMetaData().primaryTerm(shardPath.getShardId().id()); final TranslogDeletionPolicy translogDeletionPolicy = new TranslogDeletionPolicy(indexSettings.getTranslogRetentionSize().getBytes(), indexSettings.getTranslogRetentionAge().getMillis()); try (Translog translog = new Translog(translogConfig, translogUUID, translogDeletionPolicy, () -> translogGlobalCheckpoint, () -> primaryTerm); Translog.Snapshot snapshot = translog.newSnapshot()) { while (snapshot.next() != null) { // just iterate over snapshot } } } catch (TranslogCorruptedException e) { clean = false; } return clean; }
for (AllocatedIndex<? extends Shard> indexService : indicesService) { final Index index = indexService.index(); final IndexMetaData currentIndexMetaData = indexService.getIndexSettings().getIndexMetaData(); final IndexMetaData newIndexMetaData = state.metaData().index(index); assert newIndexMetaData != null : "index " + index + " should have been removed by deleteIndices";
private static void checkIndexCompatibility(IndexSettings settings, String name) { if (settings.getIndexMetaData().isRoutingPartitionedIndex()) { throw new IllegalStateException("cannot create join field [" + name + "] " + "for the partitioned index " + "[" + settings.getIndex().getName() + "]"); } if (settings.isSingleType() == false) { throw new IllegalStateException("cannot create join field [" + name + "] " + "on multi-types index [" + settings.getIndex().getName() + "]"); } }
private static void checkIndexCompatibility(IndexSettings settings, String name) { if (settings.getIndexMetaData().isRoutingPartitionedIndex()) { throw new IllegalStateException("cannot create join field [" + name + "] " + "for the partitioned index " + "[" + settings.getIndex().getName() + "]"); } if (settings.isSingleType() == false) { throw new IllegalStateException("cannot create join field [" + name + "] " + "on multi-types index [" + settings.getIndex().getName() + "]"); } }
private static void checkIndexCompatibility(IndexSettings settings, String name) { if (settings.getIndexMetaData().isRoutingPartitionedIndex()) { throw new IllegalStateException("cannot create join field [" + name + "] " + "for the partitioned index " + "[" + settings.getIndex().getName() + "]"); } if (settings.isSingleType() == false) { throw new IllegalStateException("cannot create join field [" + name + "] " + "on multi-types index [" + settings.getIndex().getName() + "]"); } }
private void checkPartitionedIndexConstraints(DocumentMapper newMapper) { if (indexSettings.getIndexMetaData().isRoutingPartitionedIndex()) { if (newMapper.parentFieldMapper().active()) { throw new IllegalArgumentException("mapping type name [" + newMapper.type() + "] cannot have a " + "_parent field for the partitioned index [" + indexSettings.getIndex().getName() + "]"); } if (!newMapper.routingFieldMapper().required()) { throw new IllegalArgumentException("mapping type [" + newMapper.type() + "] must have routing " + "required for partitioned index [" + indexSettings.getIndex().getName() + "]"); } } }
private FsDirectoryService randomDirectoryService(IndexStore indexStore, ShardPath path) { final IndexSettings indexSettings = indexStore.getIndexSettings(); final IndexMetaData build = IndexMetaData.builder(indexSettings.getIndexMetaData()) .settings(Settings.builder() // don't use the settings from indexSettings#getSettings() they are merged with node settings and might contain // secure settings that should not be copied in here since the new IndexSettings ctor below will barf if we do .put(indexSettings.getIndexMetaData().getSettings()) .put(IndexModule.INDEX_STORE_TYPE_SETTING.getKey(), RandomPicks.randomFrom(random, IndexModule.Type.values()).getSettingsKey())) .build(); final IndexSettings newIndexSettings = new IndexSettings(build, indexSettings.getNodeSettings()); return new FsDirectoryService(newIndexSettings, indexStore, path); }
case UPDATED: IndexRequest indexRequest = updateResult.action(); IndexMetaData metaData = context.getPrimary().indexSettings().getIndexMetaData(); MappingMetaData mappingMd = metaData.mappingOrDefault(indexRequest.type()); indexRequest.process(metaData.getCreationVersion(), mappingMd, updateRequest.concreteIndex());
private void checkPartitionedIndexConstraints(DocumentMapper newMapper) { if (indexSettings.getIndexMetaData().isRoutingPartitionedIndex()) { if (newMapper.parentFieldMapper().active()) { throw new IllegalArgumentException("mapping type name [" + newMapper.type() + "] cannot have a " + "_parent field for the partitioned index [" + indexSettings.getIndex().getName() + "]"); } if (!newMapper.routingFieldMapper().required()) { throw new IllegalArgumentException("mapping type [" + newMapper.type() + "] must have routing " + "required for partitioned index [" + indexSettings.getIndex().getName() + "]"); } } }
private void checkPartitionedIndexConstraints(DocumentMapper newMapper) { if (indexSettings.getIndexMetaData().isRoutingPartitionedIndex()) { if (newMapper.parentFieldMapper().active()) { throw new IllegalArgumentException("mapping type name [" + newMapper.type() + "] cannot have a " + "_parent field for the partitioned index [" + indexSettings.getIndex().getName() + "]"); } if (!newMapper.routingFieldMapper().required()) { throw new IllegalArgumentException("mapping type [" + newMapper.type() + "] must have routing " + "required for partitioned index [" + indexSettings.getIndex().getName() + "]"); } } }
protected Consumer<Mapping> getMappingUpdater(IndexShard shard, String type) { return update -> { try { updateMappings(shard, IndexMetaData.builder(shard.indexSettings().getIndexMetaData()) .putMapping(type, update.toString()).build()); } catch (IOException e) { ExceptionsHelper.reThrowIfNotNull(e); } }; }