Search in sources :

Example 71 with IndexSettings

use of org.opensearch.index.IndexSettings in project OpenSearch by opensearch-project.

the class IndexShard method maybeSyncGlobalCheckpoint.

/**
 * Syncs the global checkpoint to the replicas if the global checkpoint on at least one replica is behind the global checkpoint on the
 * primary.
 */
public void maybeSyncGlobalCheckpoint(final String reason) {
    verifyNotClosed();
    assert shardRouting.primary() : "only call maybeSyncGlobalCheckpoint on primary shard";
    if (replicationTracker.isPrimaryMode() == false) {
        return;
    }
    assert assertPrimaryMode();
    // only sync if there are no operations in flight, or when using async durability
    final SeqNoStats stats = getEngine().getSeqNoStats(replicationTracker.getGlobalCheckpoint());
    final boolean asyncDurability = indexSettings().getTranslogDurability() == Translog.Durability.ASYNC;
    if (stats.getMaxSeqNo() == stats.getGlobalCheckpoint() || asyncDurability) {
        final ObjectLongMap<String> globalCheckpoints = getInSyncGlobalCheckpoints();
        final long globalCheckpoint = replicationTracker.getGlobalCheckpoint();
        // async durability means that the local checkpoint might lag (as it is only advanced on fsync)
        // periodically ask for the newest local checkpoint by syncing the global checkpoint, so that ultimately the global
        // checkpoint can be synced. Also take into account that a shard might be pending sync, which means that it isn't
        // in the in-sync set just yet but might be blocked on waiting for its persisted local checkpoint to catch up to
        // the global checkpoint.
        final boolean syncNeeded = (asyncDurability && (stats.getGlobalCheckpoint() < stats.getMaxSeqNo() || replicationTracker.pendingInSync())) || // check if the persisted global checkpoint
        StreamSupport.stream(globalCheckpoints.values().spliterator(), false).anyMatch(v -> v.value < globalCheckpoint);
        // only sync if index is not closed and there is a shard lagging the primary
        if (syncNeeded && indexSettings.getIndexMetadata().getState() == IndexMetadata.State.OPEN) {
            logger.trace("syncing global checkpoint for [{}]", reason);
            globalCheckpointSyncer.run();
        }
    }
}
Also used : Query(org.apache.lucene.search.Query) SeqNoStats(org.opensearch.index.seqno.SeqNoStats) SequenceNumbers(org.opensearch.index.seqno.SequenceNumbers) Arrays(java.util.Arrays) LongSupplier(java.util.function.LongSupplier) CheckedFunction(org.opensearch.common.CheckedFunction) SnapshotRecoverySource(org.opensearch.cluster.routing.RecoverySource.SnapshotRecoverySource) SearchStats(org.opensearch.index.search.stats.SearchStats) MetadataSnapshot(org.opensearch.index.store.Store.MetadataSnapshot) Term(org.apache.lucene.index.Term) AlreadyClosedException(org.apache.lucene.store.AlreadyClosedException) ReferenceManager(org.apache.lucene.search.ReferenceManager) DocumentMapperForType(org.opensearch.index.mapper.DocumentMapperForType) MergeStats(org.opensearch.index.merge.MergeStats) UsageTrackingQueryCachingPolicy(org.apache.lucene.search.UsageTrackingQueryCachingPolicy) WriteStateException(org.opensearch.gateway.WriteStateException) RecoveryState(org.opensearch.indices.recovery.RecoveryState) RefreshFailedEngineException(org.opensearch.index.engine.RefreshFailedEngineException) Map(java.util.Map) Lucene(org.opensearch.common.lucene.Lucene) ObjectLongMap(com.carrotsearch.hppc.ObjectLongMap) QueryCachingPolicy(org.apache.lucene.search.QueryCachingPolicy) ActionListener(org.opensearch.action.ActionListener) GetResult(org.opensearch.index.engine.Engine.GetResult) IndexModule(org.opensearch.index.IndexModule) Segment(org.opensearch.index.engine.Segment) EnumSet(java.util.EnumSet) Repository(org.opensearch.repositories.Repository) TimeValue(org.opensearch.common.unit.TimeValue) ShardRequestCache(org.opensearch.index.cache.request.ShardRequestCache) Index(org.opensearch.index.Index) ExceptionsHelper(org.opensearch.ExceptionsHelper) Set(java.util.Set) Settings(org.opensearch.common.settings.Settings) ReplicationTracker(org.opensearch.index.seqno.ReplicationTracker) ShardBitsetFilterCache(org.opensearch.index.cache.bitset.ShardBitsetFilterCache) GetStats(org.opensearch.index.get.GetStats) StandardCharsets(java.nio.charset.StandardCharsets) Engine(org.opensearch.index.engine.Engine) ClosedByInterruptException(java.nio.channels.ClosedByInterruptException) CountDownLatch(java.util.concurrent.CountDownLatch) VersionType(org.opensearch.index.VersionType) Logger(org.apache.logging.log4j.Logger) EngineConfigFactory(org.opensearch.index.engine.EngineConfigFactory) CheckedRunnable(org.opensearch.common.CheckedRunnable) ThreadInterruptedException(org.apache.lucene.util.ThreadInterruptedException) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) IndexCommit(org.apache.lucene.index.IndexCommit) ShardFieldData(org.opensearch.index.fielddata.ShardFieldData) RepositoriesService(org.opensearch.repositories.RepositoriesService) CodecService(org.opensearch.index.codec.CodecService) FlushRequest(org.opensearch.action.admin.indices.flush.FlushRequest) MapperParsingException(org.opensearch.index.mapper.MapperParsingException) ThreadPool(org.opensearch.threadpool.ThreadPool) Releasable(org.opensearch.common.lease.Releasable) MeanMetric(org.opensearch.common.metrics.MeanMetric) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) RecoverySource(org.opensearch.cluster.routing.RecoverySource) UNASSIGNED_SEQ_NO(org.opensearch.index.seqno.SequenceNumbers.UNASSIGNED_SEQ_NO) FilterDirectoryReader(org.apache.lucene.index.FilterDirectoryReader) LegacyESVersion(org.opensearch.LegacyESVersion) Mapping(org.opensearch.index.mapper.Mapping) Booleans(org.opensearch.common.Booleans) BiConsumer(java.util.function.BiConsumer) ParsedDocument(org.opensearch.index.mapper.ParsedDocument) RetentionLeaseStats(org.opensearch.index.seqno.RetentionLeaseStats) StreamSupport(java.util.stream.StreamSupport) CommitStats(org.opensearch.index.engine.CommitStats) EngineFactory(org.opensearch.index.engine.EngineFactory) CompletionStats(org.opensearch.search.suggest.completion.CompletionStats) SetOnce(org.apache.lucene.util.SetOnce) RecoveryFailedException(org.opensearch.indices.recovery.RecoveryFailedException) PendingReplicationActions(org.opensearch.action.support.replication.PendingReplicationActions) RETAIN_ALL(org.opensearch.index.seqno.RetentionLeaseActions.RETAIN_ALL) FlushStats(org.opensearch.index.flush.FlushStats) IOException(java.io.IOException) BytesStreamOutput(org.opensearch.common.io.stream.BytesStreamOutput) IndexService(org.opensearch.index.IndexService) XContentHelper(org.opensearch.common.xcontent.XContentHelper) AtomicLong(java.util.concurrent.atomic.AtomicLong) RecoveryStats(org.opensearch.index.recovery.RecoveryStats) RetentionLeases(org.opensearch.index.seqno.RetentionLeases) CounterMetric(org.opensearch.common.metrics.CounterMetric) ShardIndexWarmerService(org.opensearch.index.warmer.ShardIndexWarmerService) RetentionLeaseSyncer(org.opensearch.index.seqno.RetentionLeaseSyncer) SafeCommitInfo(org.opensearch.index.engine.SafeCommitInfo) EngineException(org.opensearch.index.engine.EngineException) ReadOnlyEngine(org.opensearch.index.engine.ReadOnlyEngine) IdFieldMapper(org.opensearch.index.mapper.IdFieldMapper) AbstractRunnable(org.opensearch.common.util.concurrent.AbstractRunnable) FieldDataStats(org.opensearch.index.fielddata.FieldDataStats) TimeoutException(java.util.concurrent.TimeoutException) OpenSearchException(org.opensearch.OpenSearchException) ThreadContext(org.opensearch.common.util.concurrent.ThreadContext) Releasables(org.opensearch.common.lease.Releasables) UpgradeRequest(org.opensearch.action.admin.indices.upgrade.post.UpgradeRequest) RunOnce(org.opensearch.common.util.concurrent.RunOnce) ForceMergeRequest(org.opensearch.action.admin.indices.forcemerge.ForceMergeRequest) MapperService(org.opensearch.index.mapper.MapperService) RefreshStats(org.opensearch.index.refresh.RefreshStats) Locale(java.util.Locale) Assertions(org.opensearch.Assertions) SegmentsStats(org.opensearch.index.engine.SegmentsStats) IndexShardRoutingTable(org.opensearch.cluster.routing.IndexShardRoutingTable) IndicesClusterStateService(org.opensearch.indices.cluster.IndicesClusterStateService) CheckIndex(org.apache.lucene.index.CheckIndex) Sort(org.apache.lucene.search.Sort) DirectoryReader(org.apache.lucene.index.DirectoryReader) IndicesService(org.opensearch.indices.IndicesService) TranslogConfig(org.opensearch.index.translog.TranslogConfig) IndexingMemoryController(org.opensearch.indices.IndexingMemoryController) RestStatus(org.opensearch.rest.RestStatus) Store(org.opensearch.index.store.Store) Collectors(java.util.stream.Collectors) SegmentInfos(org.apache.lucene.index.SegmentInfos) Nullable(org.opensearch.common.Nullable) Tuple(org.opensearch.common.collect.Tuple) WarmerStats(org.opensearch.index.warmer.WarmerStats) Objects(java.util.Objects) List(java.util.List) ResyncTask(org.opensearch.index.shard.PrimaryReplicaSyncer.ResyncTask) LeafReader(org.apache.lucene.index.LeafReader) IndexSettings(org.opensearch.index.IndexSettings) ReplicationResponse(org.opensearch.action.support.replication.ReplicationResponse) Optional(java.util.Optional) BigArrays(org.opensearch.common.util.BigArrays) Uid(org.opensearch.index.mapper.Uid) TranslogStats(org.opensearch.index.translog.TranslogStats) MappingMetadata(org.opensearch.cluster.metadata.MappingMetadata) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata) ShardSearchStats(org.opensearch.index.search.stats.ShardSearchStats) ActionRunnable(org.opensearch.action.ActionRunnable) SimilarityService(org.opensearch.index.similarity.SimilarityService) CheckedConsumer(org.opensearch.common.CheckedConsumer) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ByteSizeValue(org.opensearch.common.unit.ByteSizeValue) EngineConfig(org.opensearch.index.engine.EngineConfig) ParameterizedMessage(org.apache.logging.log4j.message.ParameterizedMessage) AtomicReference(java.util.concurrent.atomic.AtomicReference) Function(java.util.function.Function) HashSet(java.util.HashSet) SourceToParse(org.opensearch.index.mapper.SourceToParse) AsyncIOProcessor(org.opensearch.common.util.concurrent.AsyncIOProcessor) PeerRecoveryTargetService(org.opensearch.indices.recovery.PeerRecoveryTargetService) Translog(org.opensearch.index.translog.Translog) StoreFileMetadata(org.opensearch.index.store.StoreFileMetadata) StoreStats(org.opensearch.index.store.StoreStats) RetentionLease(org.opensearch.index.seqno.RetentionLease) PrintStream(java.io.PrintStream) OpenSearchDirectoryReader(org.opensearch.common.lucene.index.OpenSearchDirectoryReader) RecoveryTarget(org.opensearch.indices.recovery.RecoveryTarget) IndexNotFoundException(org.opensearch.index.IndexNotFoundException) IndexCache(org.opensearch.index.cache.IndexCache) DocumentMapper(org.opensearch.index.mapper.DocumentMapper) RootObjectMapper(org.opensearch.index.mapper.RootObjectMapper) ShardRouting(org.opensearch.cluster.routing.ShardRouting) IOUtils(org.opensearch.core.internal.io.IOUtils) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) ShardGetService(org.opensearch.index.get.ShardGetService) CircuitBreakerService(org.opensearch.indices.breaker.CircuitBreakerService) Closeable(java.io.Closeable) TypeMissingException(org.opensearch.indices.TypeMissingException) Collections(java.util.Collections) SeqNoStats(org.opensearch.index.seqno.SeqNoStats)

Example 72 with IndexSettings

use of org.opensearch.index.IndexSettings in project OpenSearch by opensearch-project.

the class RemoveCorruptedShardDataCommand method findAndProcessShardPath.

protected void findAndProcessShardPath(OptionSet options, Environment environment, Path[] dataPaths, int nodeLockId, ClusterState clusterState, CheckedConsumer<ShardPath, IOException> consumer) throws IOException {
    final Settings settings = environment.settings();
    final IndexMetadata indexMetadata;
    final int shardId;
    final int fromNodeId;
    final int toNodeId;
    if (options.has(folderOption)) {
        final Path path = getPath(folderOption.value(options)).getParent();
        final Path shardParent = path.getParent();
        final Path shardParentParent = shardParent.getParent();
        final Path indexPath = path.resolve(ShardPath.INDEX_FOLDER_NAME);
        if (Files.exists(indexPath) == false || Files.isDirectory(indexPath) == false) {
            throw new OpenSearchException("index directory [" + indexPath + "], must exist and be a directory");
        }
        final String shardIdFileName = path.getFileName().toString();
        final String nodeIdFileName = shardParentParent.getParent().getFileName().toString();
        final String indexUUIDFolderName = shardParent.getFileName().toString();
        if (Files.isDirectory(path) && // SHARD-ID path element check
        shardIdFileName.chars().allMatch(Character::isDigit) && // `indices` check
        NodeEnvironment.INDICES_FOLDER.equals(shardParentParent.getFileName().toString()) && // NODE-ID check
        nodeIdFileName.chars().allMatch(Character::isDigit) && // `nodes` check
        NodeEnvironment.NODES_FOLDER.equals(shardParentParent.getParent().getParent().getFileName().toString())) {
            shardId = Integer.parseInt(shardIdFileName);
            fromNodeId = Integer.parseInt(nodeIdFileName);
            toNodeId = fromNodeId + 1;
            indexMetadata = StreamSupport.stream(clusterState.metadata().indices().values().spliterator(), false).map(imd -> imd.value).filter(imd -> imd.getIndexUUID().equals(indexUUIDFolderName)).findFirst().orElse(null);
        } else {
            throw new OpenSearchException("Unable to resolve shard id. Wrong folder structure at [ " + path.toString() + " ], expected .../nodes/[NODE-ID]/indices/[INDEX-UUID]/[SHARD-ID]");
        }
    } else {
        // otherwise resolve shardPath based on the index name and shard id
        String indexName = Objects.requireNonNull(indexNameOption.value(options), "Index name is required");
        shardId = Objects.requireNonNull(shardIdOption.value(options), "Shard ID is required");
        indexMetadata = clusterState.metadata().index(indexName);
    }
    if (indexMetadata == null) {
        throw new OpenSearchException("Unable to find index in cluster state");
    }
    final IndexSettings indexSettings = new IndexSettings(indexMetadata, settings);
    final Index index = indexMetadata.getIndex();
    final ShardId shId = new ShardId(index, shardId);
    for (Path dataPath : dataPaths) {
        final Path shardPathLocation = dataPath.resolve(NodeEnvironment.INDICES_FOLDER).resolve(index.getUUID()).resolve(Integer.toString(shId.id()));
        if (Files.exists(shardPathLocation)) {
            final ShardPath shardPath = ShardPath.loadShardPath(logger, shId, indexSettings.customDataPath(), new Path[] { shardPathLocation }, nodeLockId, dataPath);
            if (shardPath != null) {
                consumer.accept(shardPath);
                return;
            }
        }
    }
    throw new OpenSearchException("Unable to resolve shard path for index [" + indexMetadata.getIndex().getName() + "] and shard id [" + shardId + "]");
}
Also used : Path(java.nio.file.Path) NoMergePolicy(org.apache.lucene.index.NoMergePolicy) SequenceNumbers(org.opensearch.index.seqno.SequenceNumbers) Arrays(java.util.Arrays) OpenSearchException(org.opensearch.OpenSearchException) AllocateStalePrimaryAllocationCommand(org.opensearch.cluster.routing.allocation.command.AllocateStalePrimaryAllocationCommand) Strings(org.opensearch.common.Strings) NodeMetadata(org.opensearch.env.NodeMetadata) Directory(org.apache.lucene.store.Directory) Map(java.util.Map) OptionParser(joptsimple.OptionParser) Lucene(org.opensearch.common.lucene.Lucene) Path(java.nio.file.Path) OptionSet(joptsimple.OptionSet) OptionSpec(joptsimple.OptionSpec) NodeEnvironment(org.opensearch.env.NodeEnvironment) PrintWriter(java.io.PrintWriter) SuppressForbidden(org.opensearch.common.SuppressForbidden) Index(org.opensearch.index.Index) TruncateTranslogAction(org.opensearch.index.translog.TruncateTranslogAction) Settings(org.opensearch.common.settings.Settings) Store(org.opensearch.index.store.Store) OpenSearchNodeCommand(org.opensearch.cluster.coordination.OpenSearchNodeCommand) Tuple(org.opensearch.common.collect.Tuple) Engine(org.opensearch.index.engine.Engine) Objects(java.util.Objects) IndexWriter(org.apache.lucene.index.IndexWriter) Logger(org.apache.logging.log4j.Logger) IndexSettings(org.opensearch.index.IndexSettings) IndexWriterConfig(org.apache.lucene.index.IndexWriterConfig) AllocateEmptyPrimaryAllocationCommand(org.opensearch.cluster.routing.allocation.command.AllocateEmptyPrimaryAllocationCommand) PathUtils(org.opensearch.common.io.PathUtils) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata) LockObtainFailedException(org.apache.lucene.store.LockObtainFailedException) CheckedConsumer(org.opensearch.common.CheckedConsumer) NativeFSLockFactory(org.apache.lucene.store.NativeFSLockFactory) HashMap(java.util.HashMap) PersistedClusterStateService(org.opensearch.gateway.PersistedClusterStateService) ClusterState(org.opensearch.cluster.ClusterState) Lock(org.apache.lucene.store.Lock) StreamSupport(java.util.stream.StreamSupport) UUIDs(org.opensearch.common.UUIDs) FSDirectory(org.apache.lucene.store.FSDirectory) Environment(org.opensearch.env.Environment) OutputStream(java.io.OutputStream) PrintStream(java.io.PrintStream) Terminal(org.opensearch.cli.Terminal) AllocationCommands(org.opensearch.cluster.routing.allocation.command.AllocationCommands) Files(java.nio.file.Files) AllocationId(org.opensearch.cluster.routing.AllocationId) IOException(java.io.IOException) LogManager(org.apache.logging.log4j.LogManager) IndexSettings(org.opensearch.index.IndexSettings) OpenSearchException(org.opensearch.OpenSearchException) Index(org.opensearch.index.Index) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata) Settings(org.opensearch.common.settings.Settings) IndexSettings(org.opensearch.index.IndexSettings)

Example 73 with IndexSettings

use of org.opensearch.index.IndexSettings in project OpenSearch by opensearch-project.

the class SettingTests method testLogSettingUpdate.

@TestLogging(value = "org.opensearch.common.settings.IndexScopedSettings:INFO", reason = "to ensure we log INFO-level messages from IndexScopedSettings")
public void testLogSettingUpdate() throws Exception {
    final IndexMetadata metadata = newIndexMeta("index1", Settings.builder().put(IndexSettings.INDEX_REFRESH_INTERVAL_SETTING.getKey(), "20s").build());
    final IndexSettings settings = new IndexSettings(metadata, Settings.EMPTY);
    final Logger logger = LogManager.getLogger(IndexScopedSettings.class);
    try (MockLogAppender mockLogAppender = MockLogAppender.createForLoggers(logger)) {
        mockLogAppender.addExpectation(new MockLogAppender.SeenEventExpectation("message", "org.opensearch.common.settings.IndexScopedSettings", Level.INFO, "updating [index.refresh_interval] from [20s] to [10s]") {

            @Override
            public boolean innerMatch(LogEvent event) {
                return event.getMarker().getName().equals(" [index1]");
            }
        });
        settings.updateIndexMetadata(newIndexMeta("index1", Settings.builder().put(IndexSettings.INDEX_REFRESH_INTERVAL_SETTING.getKey(), "10s").build()));
        mockLogAppender.assertAllExpectationsMatched();
    }
}
Also used : MockLogAppender(org.opensearch.test.MockLogAppender) LogEvent(org.apache.logging.log4j.core.LogEvent) IndexSettings(org.opensearch.index.IndexSettings) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata) Logger(org.apache.logging.log4j.Logger) TestLogging(org.opensearch.test.junit.annotations.TestLogging)

Example 74 with IndexSettings

use of org.opensearch.index.IndexSettings in project OpenSearch by opensearch-project.

the class IndicesClientIT method testSplit.

@SuppressWarnings("unchecked")
public void testSplit() throws IOException {
    createIndex("source", Settings.builder().put("index.number_of_shards", 2).put("index.number_of_replicas", 0).put("index.number_of_routing_shards", 4).build());
    updateIndexSettings("source", Settings.builder().put("index.blocks.write", true));
    ResizeRequest resizeRequest = new ResizeRequest("target", "source");
    resizeRequest.setResizeType(ResizeType.SPLIT);
    Settings targetSettings = Settings.builder().put("index.number_of_shards", 4).put("index.number_of_replicas", 0).build();
    resizeRequest.setTargetIndex(new org.opensearch.action.admin.indices.create.CreateIndexRequest("target").settings(targetSettings).alias(new Alias("alias")));
    ResizeResponse resizeResponse = execute(resizeRequest, highLevelClient().indices()::split, highLevelClient().indices()::splitAsync);
    assertTrue(resizeResponse.isAcknowledged());
    assertTrue(resizeResponse.isShardsAcknowledged());
    Map<String, Object> getIndexResponse = getAsMap("target");
    Map<String, Object> indexSettings = (Map<String, Object>) XContentMapValues.extractValue("target.settings.index", getIndexResponse);
    assertNotNull(indexSettings);
    assertEquals("4", indexSettings.get("number_of_shards"));
    assertEquals("0", indexSettings.get("number_of_replicas"));
    Map<String, Object> aliasData = (Map<String, Object>) XContentMapValues.extractValue("target.aliases.alias", getIndexResponse);
    assertNotNull(aliasData);
}
Also used : ResizeResponse(org.opensearch.action.admin.indices.shrink.ResizeResponse) Alias(org.opensearch.action.admin.indices.alias.Alias) Matchers.containsString(org.hamcrest.Matchers.containsString) Map(java.util.Map) HashMap(java.util.HashMap) ResizeRequest(org.opensearch.action.admin.indices.shrink.ResizeRequest) Settings(org.opensearch.common.settings.Settings) IndexSettings(org.opensearch.index.IndexSettings)

Example 75 with IndexSettings

use of org.opensearch.index.IndexSettings in project OpenSearch by opensearch-project.

the class IndicesClientIT method testClone.

@SuppressWarnings("unchecked")
public void testClone() throws IOException {
    createIndex("source", Settings.builder().put("index.number_of_shards", 2).put("index.number_of_replicas", 0).put("index.number_of_routing_shards", 4).build());
    updateIndexSettings("source", Settings.builder().put("index.blocks.write", true));
    ResizeRequest resizeRequest = new ResizeRequest("target", "source");
    resizeRequest.setResizeType(ResizeType.CLONE);
    Settings targetSettings = Settings.builder().put("index.number_of_shards", 2).put("index.number_of_replicas", 0).build();
    resizeRequest.setTargetIndex(new org.opensearch.action.admin.indices.create.CreateIndexRequest("target").settings(targetSettings).alias(new Alias("alias")));
    ResizeResponse resizeResponse = execute(resizeRequest, highLevelClient().indices()::clone, highLevelClient().indices()::cloneAsync);
    assertTrue(resizeResponse.isAcknowledged());
    assertTrue(resizeResponse.isShardsAcknowledged());
    Map<String, Object> getIndexResponse = getAsMap("target");
    Map<String, Object> indexSettings = (Map<String, Object>) XContentMapValues.extractValue("target.settings.index", getIndexResponse);
    assertNotNull(indexSettings);
    assertEquals("2", indexSettings.get("number_of_shards"));
    assertEquals("0", indexSettings.get("number_of_replicas"));
    Map<String, Object> aliasData = (Map<String, Object>) XContentMapValues.extractValue("target.aliases.alias", getIndexResponse);
    assertNotNull(aliasData);
}
Also used : ResizeResponse(org.opensearch.action.admin.indices.shrink.ResizeResponse) Alias(org.opensearch.action.admin.indices.alias.Alias) Matchers.containsString(org.hamcrest.Matchers.containsString) Map(java.util.Map) HashMap(java.util.HashMap) ResizeRequest(org.opensearch.action.admin.indices.shrink.ResizeRequest) Settings(org.opensearch.common.settings.Settings) IndexSettings(org.opensearch.index.IndexSettings)

Aggregations

IndexSettings (org.opensearch.index.IndexSettings)195 Settings (org.opensearch.common.settings.Settings)137 IndexMetadata (org.opensearch.cluster.metadata.IndexMetadata)72 IOException (java.io.IOException)39 Index (org.opensearch.index.Index)32 Matchers.containsString (org.hamcrest.Matchers.containsString)25 Version (org.opensearch.Version)23 Store (org.opensearch.index.store.Store)23 Map (java.util.Map)22 QueryShardContext (org.opensearch.index.query.QueryShardContext)22 OpenSearchException (org.opensearch.OpenSearchException)21 MapperService (org.opensearch.index.mapper.MapperService)20 ShardId (org.opensearch.index.shard.ShardId)19 HashMap (java.util.HashMap)18 ArrayList (java.util.ArrayList)17 List (java.util.List)17 IndexService (org.opensearch.index.IndexService)17 IndexShard (org.opensearch.index.shard.IndexShard)17 HashSet (java.util.HashSet)16 Query (org.apache.lucene.search.Query)16