From 5fcda57b37f1d87de116c98b8234affbc29500d1 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Tue, 31 Mar 2020 16:59:01 -0400 Subject: [PATCH] Rename MetaData to Metadata in all of the places (#54519) This is a simple naming change PR, to fix the fact that "metadata" is a single English word, and for too long we have not followed general naming conventions for it. We are also not consistent about it, for example, METADATA instead of META_DATA if we were trying to be consistent with MetaData (although METADATA is correct when considered in the context of "metadata"). This was a simple find and replace across the code base, only taking a few minutes to fix this naming issue forever. --- .../allocation/AllocationBenchmark.java | 14 +- .../benchmark/rest/RestClientBenchmark.java | 6 +- .../client/GetAliasesResponse.java | 24 +- .../client/IndicesRequestConverters.java | 4 +- .../StringStatsAggregationBuilder.java | 2 +- .../TopMetricsAggregationBuilder.java | 2 +- .../indices/GetFieldMappingsResponse.java | 38 +- .../client/indices/GetIndexResponse.java | 42 +- .../indices/GetIndexTemplatesResponse.java | 32 +- .../client/indices/GetMappingsResponse.java | 12 +- ...taData.java => IndexTemplateMetadata.java} | 80 +-- .../client/rollup/GetRollupCapsRequest.java | 4 +- ...cherMetaData.java => WatcherMetadata.java} | 6 +- .../client/watcher/WatcherStatsResponse.java | 16 +- .../client/GetAliasesResponseTests.java | 22 +- .../elasticsearch/client/IndicesClientIT.java | 162 +++--- .../org/elasticsearch/client/WatcherIT.java | 4 +- .../client/core/CountResponseTests.java | 4 +- .../documentation/ILMDocumentationIT.java | 10 +- .../IndicesClientDocumentationIT.java | 42 +- .../SnapshotClientDocumentationIT.java | 16 +- .../GetFieldMappingsResponseTests.java | 14 +- .../client/indices/GetIndexResponseTests.java | 34 +- .../GetIndexTemplatesResponseTests.java | 52 +- .../indices/GetMappingsResponseTests.java | 16 +- .../rollup/GetRollupCapsRequestTests.java | 6 +- .../watcher/WatcherStatsResponseTests.java | 10 +- .../apis/find-file-structure.asciidoc | 2 +- .../release-notes/7.0.0-alpha2.asciidoc | 4 +- .../release-notes/7.0.0-beta1.asciidoc | 2 +- docs/reference/release-notes/7.0.asciidoc | 6 +- docs/reference/release-notes/7.3.asciidoc | 2 +- .../matrix/stats/InternalMatrixStats.java | 10 +- .../stats/MatrixStatsAggregationBuilder.java | 10 +- .../matrix/stats/MatrixStatsAggregator.java | 8 +- .../stats/MatrixStatsAggregatorFactory.java | 12 +- .../ArrayValuesSourceAggregationBuilder.java | 8 +- .../ArrayValuesSourceAggregatorFactory.java | 14 +- .../stats/InternalMatrixStatsTests.java | 16 +- .../common/CommonAnalysisPluginTests.java | 22 +- .../common/CompoundAnalysisTests.java | 6 +- .../common/EdgeNGramTokenizerTests.java | 4 +- .../HtmlStripCharFilterFactoryTests.java | 6 +- .../common/MultiplexerTokenFilterTests.java | 6 +- .../common/NGramTokenizerFactoryTests.java | 4 +- .../PatternCaptureTokenFilterTests.java | 4 +- .../PredicateTokenScriptFilterTests.java | 4 +- .../ScriptedConditionTokenFilterTests.java | 4 +- .../StemmerTokenFilterFactoryTests.java | 2 +- .../common/SynonymsAnalysisTests.java | 30 +- .../WhitespaceTokenizerFactoryTests.java | 6 +- ...DelimiterGraphTokenFilterFactoryTests.java | 6 +- .../ingest/common/DateIndexNameProcessor.java | 2 +- .../ingest/common/AppendProcessorTests.java | 12 +- .../ingest/common/ForEachProcessorTests.java | 4 +- .../ingest/common/SetProcessorTests.java | 16 +- .../mapper/ScaledFloatFieldTypeTests.java | 4 +- .../ChildrenAggregationBuilder.java | 10 +- .../ChildrenAggregatorFactory.java | 14 +- .../ChildrenToParentAggregator.java | 8 +- .../join/aggregations/InternalChildren.java | 6 +- .../join/aggregations/InternalParent.java | 6 +- .../ParentAggregationBuilder.java | 10 +- .../aggregations/ParentAggregatorFactory.java | 14 +- .../aggregations/ParentJoinAggregator.java | 4 +- .../ParentToChildrenAggregator.java | 8 +- .../join/mapper/ParentJoinFieldMapper.java | 2 +- .../join/aggregations/ChildrenIT.java | 6 +- .../ChildrenToParentAggregatorTests.java | 4 +- .../aggregations/InternalChildrenTests.java | 4 +- .../aggregations/InternalParentTests.java | 4 +- .../ParentToChildrenAggregatorTests.java | 4 +- .../join/query/HasChildQueryBuilderTests.java | 4 +- .../query/HasParentQueryBuilderTests.java | 4 +- .../join/query/ParentIdQueryBuilderTests.java | 4 +- .../percolator/PercolatorFieldMapper.java | 10 +- .../percolator/CandidateQueryTests.java | 6 +- .../PercolatorFieldMapperTests.java | 18 +- .../percolator/QueryBuilderStoreTests.java | 4 +- .../reindex/DeleteByQueryBasicTests.java | 4 +- .../ReindexSourceTargetValidationTests.java | 16 +- .../blobstore/url/URLBlobContainer.java | 6 +- .../repositories/url/URLRepository.java | 4 +- .../repositories/url/URLRepositoryTests.java | 22 +- .../rest/discovery/Zen2RestApiIT.java | 6 +- .../index/analysis/IcuAnalyzerTests.java | 10 +- .../analysis/IcuTokenizerFactoryTests.java | 4 +- .../index/analysis/KuromojiAnalysisTests.java | 6 +- .../index/analysis/NoriAnalysisTests.java | 8 +- .../AnalysisPhoneticFactoryTests.java | 6 +- .../analysis/SimplePhoneticAnalysisTests.java | 4 +- .../analysis/AnalysisPolishFactoryTests.java | 14 +- .../CustomAuthorizationEngineTests.java | 4 +- .../azure/AzureBlobContainer.java | 6 +- .../repositories/azure/AzureBlobStore.java | 8 +- .../repositories/azure/AzureRepository.java | 4 +- .../azure/AzureStorageService.java | 10 +- .../azure/AzureBlobContainerRetriesTests.java | 6 +- .../azure/AzureRepositorySettingsTests.java | 4 +- .../gcs/GoogleCloudStorageBlobContainer.java | 6 +- .../gcs/GoogleCloudStorageBlobStore.java | 12 +- .../gcs/GoogleCloudStorageRepository.java | 6 +- ...eCloudStorageBlobStoreRepositoryTests.java | 22 +- .../repositories/hdfs/HdfsBlobContainer.java | 12 +- .../repositories/hdfs/HdfsRepository.java | 4 +- .../repositories/hdfs/HdfsTests.java | 4 +- .../repositories/s3/S3BlobContainer.java | 12 +- .../repositories/s3/S3BlobStore.java | 12 +- .../repositories/s3/S3ClientSettings.java | 6 +- .../repositories/s3/S3Repository.java | 16 +- .../repositories/s3/S3RepositoryPlugin.java | 4 +- .../repositories/s3/S3Service.java | 28 +- .../s3/RepositoryCredentialsTests.java | 4 +- .../s3/S3BlobContainerRetriesTests.java | 6 +- .../s3/S3BlobStoreRepositoryTests.java | 4 +- .../s3/S3ClientSettingsTests.java | 6 +- .../repositories/s3/S3RepositoryTests.java | 24 +- .../s3/S3RepositoryThirdPartyTests.java | 4 +- .../metadata/EvilSystemPropertyTests.java | 6 +- .../upgrades/FullClusterRestartIT.java | 20 +- .../elasticsearch/backwards/IndexingIT.java | 14 +- .../elasticsearch/upgrades/IndexingIT.java | 6 +- .../elasticsearch/upgrades/RecoveryIT.java | 70 +-- .../http/ContextAndHeaderTransportIT.java | 2 +- .../ingest/IngestDocumentMustacheIT.java | 6 +- .../elasticsearch/ElasticsearchException.java | 2 +- .../main/java/org/elasticsearch/Version.java | 10 +- .../action/DocWriteResponse.java | 4 +- .../AddVotingConfigExclusionsRequest.java | 2 +- ...nsportAddVotingConfigExclusionsAction.java | 12 +- ...portClearVotingConfigExclusionsAction.java | 16 +- .../get/GetRepositoriesResponse.java | 16 +- .../get/TransportGetRepositoriesAction.java | 24 +- .../cluster/settings/SettingsUpdater.java | 28 +- .../TransportClusterUpdateSettingsAction.java | 10 +- .../status/SnapshotIndexShardStatus.java | 4 +- .../cluster/state/ClusterStateRequest.java | 38 +- .../state/ClusterStateRequestBuilder.java | 16 +- .../state/TransportClusterStateAction.java | 36 +- .../admin/cluster/stats/AnalysisStats.java | 14 +- .../admin/cluster/stats/MappingStats.java | 12 +- .../stats/TransportClusterStatsAction.java | 2 +- .../alias/TransportIndicesAliasesAction.java | 22 +- .../exists/TransportAliasesExistAction.java | 2 +- .../indices/alias/get/GetAliasesResponse.java | 20 +- .../alias/get/TransportGetAliasesAction.java | 12 +- .../close/TransportCloseIndexAction.java | 6 +- .../CreateIndexClusterStateUpdateRequest.java | 4 +- .../create/TransportCreateIndexAction.java | 6 +- .../datastream/CreateDataStreamAction.java | 12 +- .../datastream/DeleteDataStreamAction.java | 10 +- .../datastream/GetDataStreamsAction.java | 2 +- .../delete/TransportDeleteIndexAction.java | 6 +- .../types/TransportTypesExistsAction.java | 6 +- .../admin/indices/get/GetIndexResponse.java | 82 +-- .../indices/get/TransportGetIndexAction.java | 18 +- .../mapping/get/GetFieldMappingsResponse.java | 72 +-- .../mapping/get/GetMappingsResponse.java | 34 +- .../get/TransportGetFieldMappingsAction.java | 2 +- .../TransportGetFieldMappingsIndexAction.java | 18 +- .../get/TransportGetMappingsAction.java | 6 +- .../put/TransportPutMappingAction.java | 10 +- .../open/TransportOpenIndexAction.java | 6 +- ...vice.java => MetadataRolloverService.java} | 64 +-- .../rollover/TransportRolloverAction.java | 30 +- .../get/TransportGetSettingsAction.java | 10 +- .../put/TransportUpdateSettingsAction.java | 14 +- .../TransportIndicesShardStoresAction.java | 4 +- .../admin/indices/shrink/ResizeRequest.java | 4 +- .../indices/shrink/TransportResizeAction.java | 38 +- ...ransportDeleteComponentTemplateAction.java | 6 +- .../TransportDeleteIndexTemplateAction.java | 12 +- .../TransportDeleteIndexTemplateV2Action.java | 6 +- .../get/GetIndexTemplatesResponse.java | 24 +- .../TransportGetComponentTemplateAction.java | 2 +- .../TransportGetIndexTemplateV2Action.java | 2 +- .../get/TransportGetIndexTemplatesAction.java | 12 +- .../TransportPutComponentTemplateAction.java | 10 +- .../put/TransportPutIndexTemplateAction.java | 16 +- .../TransportPutIndexTemplateV2Action.java | 10 +- .../upgrade/post/TransportUpgradeAction.java | 8 +- .../post/TransportUpgradeSettingsAction.java | 6 +- .../action/bulk/TransportBulkAction.java | 64 +-- .../action/bulk/TransportShardBulkAction.java | 10 +- .../explain/TransportExplainAction.java | 2 +- ...TransportFieldCapabilitiesIndexAction.java | 2 +- .../action/get/TransportGetAction.java | 4 +- .../action/get/TransportMultiGetAction.java | 4 +- .../action/index/IndexRequest.java | 10 +- .../ingest/SimulatePipelineRequest.java | 20 +- .../ingest/WriteableIngestDocument.java | 30 +- .../action/main/TransportMainAction.java | 2 +- .../action/search/ShardSearchFailure.java | 4 +- .../action/support/ActiveShardCount.java | 12 +- .../replication/ReplicationResponse.java | 4 +- .../TransportBroadcastReplicationAction.java | 8 +- .../TransportReplicationAction.java | 28 +- .../TransportMultiTermVectorsAction.java | 6 +- .../TransportTermVectorsAction.java | 4 +- .../action/update/TransportUpdateAction.java | 10 +- .../bootstrap/BootstrapContext.java | 12 +- .../cluster/ClusterChangedEvent.java | 56 +- .../elasticsearch/cluster/ClusterModule.java | 84 +-- .../elasticsearch/cluster/ClusterState.java | 116 ++--- ...aData.java => MergableCustomMetadata.java} | 8 +- .../index/NodeMappingRefreshAction.java | 14 +- .../action/shard/ShardStateAction.java | 20 +- .../cluster/block/ClusterBlocks.java | 38 +- .../coordination/ClusterBootstrapService.java | 2 +- .../ClusterFormationFailureHelper.java | 6 +- ...etaData.java => CoordinationMetadata.java} | 32 +- .../coordination/CoordinationState.java | 42 +- .../cluster/coordination/Coordinator.java | 42 +- .../coordination/DetachClusterCommand.java | 16 +- .../coordination/DiscoveryUpgradeService.java | 4 +- .../ElasticsearchNodeCommand.java | 26 +- .../coordination/ElectionStrategy.java | 2 +- .../cluster/coordination/JoinHelper.java | 26 +- .../coordination/JoinTaskExecutor.java | 28 +- .../NodeRemovalClusterStateTaskExecutor.java | 4 +- .../coordination/PreVoteCollector.java | 2 +- .../cluster/coordination/Reconfigurator.java | 2 +- .../coordination/RemoveCustomsCommand.java | 12 +- .../coordination/RemoveSettingsCommand.java | 6 +- .../UnsafeBootstrapMasterCommand.java | 32 +- .../cluster/health/ClusterIndexHealth.java | 10 +- .../cluster/health/ClusterStateHealth.java | 8 +- .../cluster/metadata/AliasAction.java | 18 +- ...{AliasMetaData.java => AliasMetadata.java} | 60 +-- .../cluster/metadata/AliasValidator.java | 16 +- .../cluster/metadata/AutoExpandReplicas.java | 30 +- .../metadata/ComponentTemplateMetadata.java | 16 +- .../cluster/metadata/DataStreamMetadata.java | 16 +- .../cluster/metadata/IndexAbstraction.java | 76 +-- .../cluster/metadata/IndexGraveyard.java | 14 +- ...{IndexMetaData.java => IndexMetadata.java} | 254 +++++----- .../metadata/IndexNameExpressionResolver.java | 140 ++--- ...taData.java => IndexTemplateMetadata.java} | 114 ++--- .../metadata/IndexTemplateV2Metadata.java | 16 +- .../cluster/metadata/Manifest.java | 4 +- ...pingMetaData.java => MappingMetadata.java} | 18 +- .../metadata/{MetaData.java => Metadata.java} | 406 +++++++-------- ...e.java => MetadataCreateIndexService.java} | 274 +++++----- ...e.java => MetadataDeleteIndexService.java} | 20 +- ....java => MetadataIndexAliasesService.java} | 30 +- ...ce.java => MetadataIndexStateService.java} | 98 ++-- ...java => MetadataIndexTemplateService.java} | 118 ++--- ....java => MetadataIndexUpgradeService.java} | 64 +-- ...rvice.java => MetadataMappingService.java} | 62 +-- ...ava => MetadataUpdateSettingsService.java} | 106 ++-- ...etaData.java => RepositoriesMetadata.java} | 56 +- ...yMetaData.java => RepositoryMetadata.java} | 18 +- .../cluster/metadata/Template.java | 20 +- .../metadata/TemplateUpgradeService.java | 36 +- .../cluster/routing/IndexRoutingTable.java | 70 +-- .../cluster/routing/OperationRouting.java | 36 +- .../cluster/routing/RecoverySource.java | 6 +- .../cluster/routing/RoutingNodes.java | 14 +- .../cluster/routing/RoutingTable.java | 62 +-- .../cluster/routing/ShardRouting.java | 4 +- .../cluster/routing/UnassignedInfo.java | 6 +- .../routing/allocation/AllocationService.java | 48 +- .../allocation/DiskThresholdMonitor.java | 10 +- ...Updater.java => IndexMetadataUpdater.java} | 104 ++-- .../routing/allocation/RoutingAllocation.java | 22 +- .../allocator/BalancedShardsAllocator.java | 20 +- .../AbstractAllocateAllocationCommand.java | 2 +- .../command/CancelAllocationCommand.java | 12 +- .../allocation/decider/AllocationDecider.java | 6 +- .../decider/AllocationDeciders.java | 10 +- .../decider/AwarenessAllocationDecider.java | 6 +- .../decider/DiskThresholdDecider.java | 32 +- .../decider/EnableAllocationDecider.java | 16 +- .../decider/FilterAllocationDecider.java | 24 +- .../decider/MaxRetryAllocationDecider.java | 6 +- ...alanceOnlyWhenActiveAllocationDecider.java | 2 +- .../decider/ResizeAllocationDecider.java | 18 +- .../decider/ShardsLimitAllocationDecider.java | 4 +- .../service/ClusterApplierService.java | 12 +- .../cluster/service/MasterService.java | 6 +- .../common/blobstore/BlobContainer.java | 8 +- .../{BlobMetaData.java => BlobMetadata.java} | 2 +- .../common/blobstore/fs/FsBlobContainer.java | 12 +- ...obMetaData.java => PlainBlobMetadata.java} | 6 +- .../common/io/stream/StreamOutput.java | 4 +- .../NodeAndClusterIdStateListener.java | 2 +- .../common/settings/ClusterSettings.java | 8 +- .../settings/ConsistentSettingsService.java | 12 +- .../common/settings/IndexScopedSettings.java | 68 +-- .../zen/PendingClusterStatesQueue.java | 12 +- .../elasticsearch/env/NodeEnvironment.java | 80 +-- .../{NodeMetaData.java => NodeMetadata.java} | 34 +- .../env/NodeRepurposeCommand.java | 44 +- .../env/OverrideNodeVersionCommand.java | 14 +- .../gateway/ClusterStateUpdaters.java | 58 +-- .../gateway/DanglingIndicesState.java | 64 +-- .../org/elasticsearch/gateway/Gateway.java | 48 +- .../gateway/GatewayAllocator.java | 26 +- .../gateway/GatewayMetaState.java | 102 ++-- .../elasticsearch/gateway/GatewayService.java | 2 +- .../IncrementalClusterStateWriter.java | 100 ++-- .../gateway/LocalAllocateDangledIndices.java | 70 +-- .../gateway/MetaStateService.java | 102 ++-- ...teFormat.java => MetadataStateFormat.java} | 12 +- .../gateway/PersistedClusterStateService.java | 208 ++++---- .../gateway/PrimaryShardAllocator.java | 6 +- .../gateway/PriorityComparator.java | 10 +- .../gateway/ReplicaShardAllocator.java | 84 +-- .../TransportNodesListGatewayMetaState.java | 20 +- ...ransportNodesListGatewayStartedShards.java | 30 +- .../org/elasticsearch/index/IndexService.java | 40 +- .../elasticsearch/index/IndexSettings.java | 50 +- .../index/analysis/AnalysisRegistry.java | 10 +- .../index/get/ShardGetService.java | 8 +- .../index/mapper/CompletionFieldMapper.java | 38 +- .../index/mapper/MapperService.java | 72 +-- .../elasticsearch/index/mapper/Mapping.java | 8 +- .../index/query/IdsQueryBuilder.java | 4 +- .../index/seqno/ReplicationTracker.java | 4 +- .../index/seqno/RetentionLeases.java | 4 +- .../elasticsearch/index/shard/IndexShard.java | 38 +- .../index/shard/LocalShardSnapshot.java | 6 +- .../RemoveCorruptedShardDataCommand.java | 38 +- .../elasticsearch/index/shard/ShardId.java | 4 +- .../elasticsearch/index/shard/ShardPath.java | 10 +- .../index/shard/ShardSplittingQuery.java | 26 +- ...eMetaData.java => ShardStateMetadata.java} | 30 +- .../index/shard/StoreRecovery.java | 26 +- .../BlobStoreIndexShardSnapshot.java | 20 +- .../org/elasticsearch/index/store/Store.java | 100 ++-- ...leMetaData.java => StoreFileMetadata.java} | 10 +- .../translog/TruncateTranslogAction.java | 8 +- .../elasticsearch/indices/IndicesModule.java | 6 +- .../indices/IndicesRequestCache.java | 2 +- .../elasticsearch/indices/IndicesService.java | 124 ++--- .../indices/analysis/AnalysisModule.java | 10 +- .../cluster/IndicesClusterStateService.java | 82 +-- .../indices/flush/SyncedFlushService.java | 22 +- .../indices/mapper/MapperRegistry.java | 2 +- .../indices/recovery/MultiFileTransfer.java | 28 +- .../indices/recovery/MultiFileWriter.java | 24 +- .../recovery/PeerRecoveryTargetService.java | 6 +- .../recovery/RecoveryFileChunkRequest.java | 26 +- .../recovery/RecoverySourceHandler.java | 38 +- .../indices/recovery/RecoveryTarget.java | 10 +- .../recovery/RecoveryTargetHandler.java | 8 +- .../recovery/RemoteRecoveryTargetHandler.java | 10 +- .../indices/store/IndicesStore.java | 6 +- ...TransportNodesListShardStoreMetadata.java} | 106 ++-- .../elasticsearch/ingest/IngestDocument.java | 32 +- .../elasticsearch/ingest/IngestMetadata.java | 16 +- .../elasticsearch/ingest/IngestService.java | 30 +- .../java/org/elasticsearch/node/Node.java | 44 +- .../persistent/AllocatedPersistentTask.java | 8 +- .../persistent/PersistentTaskResponse.java | 2 +- .../PersistentTasksClusterService.java | 54 +- ...ava => PersistentTasksCustomMetadata.java} | 48 +- .../persistent/PersistentTasksExecutor.java | 6 +- .../PersistentTasksNodeService.java | 6 +- .../persistent/PersistentTasksService.java | 12 +- .../persistent/package-info.java | 4 +- ...ataUpgrader.java => MetadataUpgrader.java} | 18 +- .../org/elasticsearch/plugins/Plugin.java | 12 +- .../repositories/FilterRepository.java | 24 +- .../repositories/RepositoriesService.java | 120 ++--- .../repositories/Repository.java | 26 +- .../blobstore/BlobStoreRepository.java | 154 +++--- .../blobstore/ChecksumBlobStoreFormat.java | 6 +- .../blobstore/FileRestoreContext.java | 20 +- .../repositories/blobstore/package-info.java | 18 +- .../repositories/fs/FsRepository.java | 6 +- .../cluster/RestClusterGetSettingsAction.java | 6 +- .../admin/cluster/RestClusterStateAction.java | 10 +- .../admin/indices/RestGetAliasesAction.java | 22 +- .../indices/RestGetFieldMappingAction.java | 14 +- .../admin/indices/RestGetMappingAction.java | 6 +- .../rest/action/cat/RestAliasAction.java | 16 +- .../rest/action/cat/RestIndicesAction.java | 22 +- .../action/cat/RestRepositoriesAction.java | 8 +- .../rest/action/cat/RestShardsAction.java | 2 +- .../rest/action/cat/RestTemplatesAction.java | 12 +- ...criptMetaData.java => ScriptMetadata.java} | 64 +-- .../elasticsearch/script/ScriptService.java | 24 +- .../script/StoredScriptSource.java | 4 +- .../org/elasticsearch/search/SearchHit.java | 4 +- .../AbstractAggregationBuilder.java | 30 +- .../search/aggregations/Aggregation.java | 2 +- .../aggregations/AggregationBuilder.java | 12 +- .../search/aggregations/AggregatorBase.java | 12 +- .../aggregations/AggregatorFactories.java | 8 +- .../aggregations/AggregatorFactory.java | 10 +- .../aggregations/BaseAggregationBuilder.java | 4 +- .../aggregations/InternalAggregation.java | 22 +- .../InternalMultiBucketAggregation.java | 4 +- .../aggregations/NonCollectingAggregator.java | 8 +- .../aggregations/ParsedAggregation.java | 4 +- .../PipelineAggregationBuilder.java | 2 +- .../bucket/BucketsAggregator.java | 4 +- .../bucket/DeferableBucketAggregator.java | 4 +- .../InternalSingleBucketAggregation.java | 4 +- .../AdjacencyMatrixAggregationBuilder.java | 10 +- .../adjacency/AdjacencyMatrixAggregator.java | 10 +- .../AdjacencyMatrixAggregatorFactory.java | 8 +- .../adjacency/InternalAdjacencyMatrix.java | 8 +- .../CompositeAggregationBuilder.java | 10 +- .../CompositeAggregationFactory.java | 8 +- .../bucket/composite/CompositeAggregator.java | 8 +- .../bucket/composite/InternalComposite.java | 8 +- .../filter/FilterAggregationBuilder.java | 10 +- .../bucket/filter/FilterAggregator.java | 8 +- .../filter/FilterAggregatorFactory.java | 10 +- .../filter/FiltersAggregationBuilder.java | 10 +- .../bucket/filter/FiltersAggregator.java | 8 +- .../filter/FiltersAggregatorFactory.java | 10 +- .../bucket/filter/InternalFilter.java | 6 +- .../bucket/filter/InternalFilters.java | 8 +- .../geogrid/GeoGridAggregationBuilder.java | 8 +- .../bucket/geogrid/GeoGridAggregator.java | 10 +- .../GeoHashGridAggregationBuilder.java | 12 +- .../bucket/geogrid/GeoHashGridAggregator.java | 10 +- .../geogrid/GeoHashGridAggregatorFactory.java | 14 +- .../GeoTileGridAggregationBuilder.java | 12 +- .../bucket/geogrid/GeoTileGridAggregator.java | 10 +- .../geogrid/GeoTileGridAggregatorFactory.java | 14 +- .../bucket/geogrid/InternalGeoGrid.java | 8 +- .../bucket/geogrid/InternalGeoHashGrid.java | 10 +- .../bucket/geogrid/InternalGeoTileGrid.java | 10 +- .../global/GlobalAggregationBuilder.java | 10 +- .../bucket/global/GlobalAggregator.java | 6 +- .../global/GlobalAggregatorFactory.java | 8 +- .../bucket/global/InternalGlobal.java | 6 +- .../AutoDateHistogramAggregationBuilder.java | 10 +- .../AutoDateHistogramAggregator.java | 8 +- .../AutoDateHistogramAggregatorFactory.java | 16 +- .../DateHistogramAggregationBuilder.java | 10 +- .../histogram/DateHistogramAggregator.java | 8 +- .../DateHistogramAggregatorFactory.java | 22 +- .../DateRangeHistogramAggregator.java | 8 +- .../HistogramAggregationBuilder.java | 10 +- .../histogram/HistogramAggregatorFactory.java | 14 +- .../histogram/InternalAutoDateHistogram.java | 10 +- .../histogram/InternalDateHistogram.java | 10 +- .../bucket/histogram/InternalHistogram.java | 10 +- .../histogram/NumericHistogramAggregator.java | 8 +- .../histogram/RangeHistogramAggregator.java | 8 +- .../bucket/missing/InternalMissing.java | 6 +- .../missing/MissingAggregationBuilder.java | 12 +- .../bucket/missing/MissingAggregator.java | 8 +- .../missing/MissingAggregatorFactory.java | 12 +- .../bucket/nested/InternalNested.java | 6 +- .../bucket/nested/InternalReverseNested.java | 6 +- .../nested/NestedAggregationBuilder.java | 12 +- .../bucket/nested/NestedAggregator.java | 8 +- .../nested/NestedAggregatorFactory.java | 16 +- .../ReverseNestedAggregationBuilder.java | 8 +- .../nested/ReverseNestedAggregator.java | 8 +- .../ReverseNestedAggregatorFactory.java | 16 +- .../range/AbstractRangeAggregatorFactory.java | 12 +- .../bucket/range/AbstractRangeBuilder.java | 4 +- .../bucket/range/BinaryRangeAggregator.java | 8 +- .../range/BinaryRangeAggregatorFactory.java | 12 +- .../range/DateRangeAggregationBuilder.java | 10 +- .../range/DateRangeAggregatorFactory.java | 4 +- .../range/GeoDistanceAggregationBuilder.java | 10 +- .../GeoDistanceRangeAggregatorFactory.java | 12 +- .../bucket/range/InternalBinaryRange.java | 8 +- .../bucket/range/InternalDateRange.java | 10 +- .../bucket/range/InternalGeoDistance.java | 10 +- .../bucket/range/InternalRange.java | 12 +- .../range/IpRangeAggregationBuilder.java | 10 +- .../bucket/range/RangeAggregationBuilder.java | 10 +- .../bucket/range/RangeAggregator.java | 14 +- .../bucket/range/RangeAggregatorFactory.java | 4 +- .../DiversifiedAggregationBuilder.java | 10 +- .../sampler/DiversifiedAggregatorFactory.java | 16 +- ...DiversifiedBytesHashSamplerAggregator.java | 4 +- .../DiversifiedMapSamplerAggregator.java | 4 +- .../DiversifiedNumericSamplerAggregator.java | 4 +- .../DiversifiedOrdinalsSamplerAggregator.java | 4 +- .../bucket/sampler/InternalSampler.java | 6 +- .../sampler/SamplerAggregationBuilder.java | 10 +- .../bucket/sampler/SamplerAggregator.java | 22 +- .../sampler/SamplerAggregatorFactory.java | 8 +- .../bucket/sampler/UnmappedSampler.java | 6 +- ...balOrdinalsSignificantTermsAggregator.java | 8 +- .../InternalMappedSignificantTerms.java | 6 +- .../significant/InternalSignificantTerms.java | 4 +- .../significant/SignificantLongTerms.java | 8 +- .../SignificantLongTermsAggregator.java | 8 +- .../significant/SignificantStringTerms.java | 8 +- .../SignificantStringTermsAggregator.java | 8 +- .../SignificantTermsAggregationBuilder.java | 12 +- .../SignificantTermsAggregatorFactory.java | 26 +- .../SignificantTextAggregationBuilder.java | 10 +- .../SignificantTextAggregator.java | 8 +- .../SignificantTextAggregatorFactory.java | 8 +- .../significant/UnmappedSignificantTerms.java | 8 +- .../terms/AbstractRareTermsAggregator.java | 4 +- .../terms/AbstractStringTermsAggregator.java | 6 +- .../bucket/terms/DoubleTerms.java | 8 +- .../bucket/terms/DoubleTermsAggregator.java | 6 +- .../GlobalOrdinalsStringTermsAggregator.java | 10 +- .../bucket/terms/InternalMappedRareTerms.java | 4 +- .../bucket/terms/InternalMappedTerms.java | 4 +- .../bucket/terms/InternalRareTerms.java | 4 +- .../bucket/terms/InternalTerms.java | 4 +- .../bucket/terms/LongRareTerms.java | 8 +- .../bucket/terms/LongRareTermsAggregator.java | 8 +- .../aggregations/bucket/terms/LongTerms.java | 10 +- .../bucket/terms/LongTermsAggregator.java | 8 +- .../terms/RareTermsAggregationBuilder.java | 10 +- .../terms/RareTermsAggregatorFactory.java | 22 +- .../bucket/terms/StringRareTerms.java | 8 +- .../terms/StringRareTermsAggregator.java | 8 +- .../bucket/terms/StringTerms.java | 8 +- .../bucket/terms/StringTermsAggregator.java | 6 +- .../bucket/terms/TermsAggregationBuilder.java | 10 +- .../bucket/terms/TermsAggregator.java | 4 +- .../bucket/terms/TermsAggregatorFactory.java | 30 +- .../bucket/terms/UnmappedRareTerms.java | 8 +- .../bucket/terms/UnmappedTerms.java | 8 +- .../AbstractHDRPercentilesAggregator.java | 4 +- .../AbstractInternalHDRPercentiles.java | 8 +- .../AbstractInternalTDigestPercentiles.java | 8 +- .../AbstractTDigestPercentilesAggregator.java | 4 +- .../metrics/AvgAggregationBuilder.java | 10 +- .../aggregations/metrics/AvgAggregator.java | 8 +- .../metrics/AvgAggregatorFactory.java | 12 +- .../CardinalityAggregationBuilder.java | 10 +- .../metrics/CardinalityAggregator.java | 8 +- .../metrics/CardinalityAggregatorFactory.java | 12 +- .../ExtendedStatsAggregationBuilder.java | 10 +- .../metrics/ExtendedStatsAggregator.java | 8 +- .../ExtendedStatsAggregatorFactory.java | 12 +- .../metrics/GeoBoundsAggregationBuilder.java | 12 +- .../metrics/GeoBoundsAggregator.java | 8 +- .../metrics/GeoBoundsAggregatorFactory.java | 12 +- .../GeoCentroidAggregationBuilder.java | 10 +- .../metrics/GeoCentroidAggregator.java | 8 +- .../metrics/GeoCentroidAggregatorFactory.java | 12 +- .../metrics/HDRPercentileRanksAggregator.java | 8 +- .../HDRPercentileRanksAggregatorFactory.java | 12 +- .../metrics/HDRPercentilesAggregator.java | 8 +- .../HDRPercentilesAggregatorFactory.java | 12 +- .../aggregations/metrics/InternalAvg.java | 6 +- .../metrics/InternalCardinality.java | 6 +- .../metrics/InternalExtendedStats.java | 6 +- .../metrics/InternalGeoBounds.java | 6 +- .../metrics/InternalGeoCentroid.java | 6 +- .../metrics/InternalHDRPercentileRanks.java | 8 +- .../metrics/InternalHDRPercentiles.java | 8 +- .../aggregations/metrics/InternalMax.java | 6 +- .../InternalMedianAbsoluteDeviation.java | 6 +- .../aggregations/metrics/InternalMin.java | 6 +- .../InternalNumericMetricsAggregation.java | 12 +- .../metrics/InternalScriptedMetric.java | 10 +- .../aggregations/metrics/InternalStats.java | 6 +- .../aggregations/metrics/InternalSum.java | 6 +- .../InternalTDigestPercentileRanks.java | 8 +- .../metrics/InternalTDigestPercentiles.java | 8 +- .../aggregations/metrics/InternalTopHits.java | 6 +- .../metrics/InternalValueCount.java | 6 +- .../metrics/InternalWeightedAvg.java | 6 +- .../metrics/MaxAggregationBuilder.java | 10 +- .../aggregations/metrics/MaxAggregator.java | 8 +- .../metrics/MaxAggregatorFactory.java | 12 +- ...anAbsoluteDeviationAggregationBuilder.java | 10 +- .../MedianAbsoluteDeviationAggregator.java | 8 +- ...ianAbsoluteDeviationAggregatorFactory.java | 12 +- .../metrics/MetricsAggregator.java | 6 +- .../metrics/MinAggregationBuilder.java | 10 +- .../aggregations/metrics/MinAggregator.java | 8 +- .../metrics/MinAggregatorFactory.java | 12 +- .../metrics/NumericMetricsAggregator.java | 12 +- .../PercentileRanksAggregationBuilder.java | 12 +- .../PercentilesAggregationBuilder.java | 12 +- .../ScriptedMetricAggregationBuilder.java | 10 +- .../metrics/ScriptedMetricAggregator.java | 8 +- .../ScriptedMetricAggregatorFactory.java | 8 +- .../metrics/StatsAggregationBuilder.java | 12 +- .../aggregations/metrics/StatsAggregator.java | 8 +- .../metrics/StatsAggregatorFactory.java | 12 +- .../metrics/SumAggregationBuilder.java | 10 +- .../aggregations/metrics/SumAggregator.java | 8 +- .../metrics/SumAggregatorFactory.java | 12 +- .../TDigestPercentileRanksAggregator.java | 8 +- ...igestPercentileRanksAggregatorFactory.java | 12 +- .../metrics/TDigestPercentilesAggregator.java | 8 +- .../TDigestPercentilesAggregatorFactory.java | 12 +- .../metrics/TopHitsAggregationBuilder.java | 10 +- .../metrics/TopHitsAggregator.java | 8 +- .../metrics/TopHitsAggregatorFactory.java | 8 +- .../metrics/ValueCountAggregationBuilder.java | 10 +- .../metrics/ValueCountAggregator.java | 8 +- .../metrics/ValueCountAggregatorFactory.java | 12 +- .../WeightedAvgAggregationBuilder.java | 10 +- .../metrics/WeightedAvgAggregator.java | 8 +- .../metrics/WeightedAvgAggregatorFactory.java | 14 +- .../AbstractPipelineAggregationBuilder.java | 22 +- .../AvgBucketPipelineAggregationBuilder.java | 4 +- .../pipeline/AvgBucketPipelineAggregator.java | 4 +- ...cketMetricsPipelineAggregationBuilder.java | 2 +- .../BucketMetricsPipelineAggregator.java | 6 +- ...ucketScriptPipelineAggregationBuilder.java | 4 +- .../BucketScriptPipelineAggregator.java | 2 +- ...ketSelectorPipelineAggregationBuilder.java | 4 +- .../BucketSortPipelineAggregationBuilder.java | 4 +- ...mulativeSumPipelineAggregationBuilder.java | 4 +- .../CumulativeSumPipelineAggregator.java | 2 +- .../DerivativePipelineAggregationBuilder.java | 4 +- .../DerivativePipelineAggregator.java | 2 +- ...StatsBucketPipelineAggregationBuilder.java | 4 +- ...ExtendedStatsBucketPipelineAggregator.java | 4 +- .../pipeline/InternalBucketMetricValue.java | 4 +- .../pipeline/InternalDerivative.java | 4 +- .../pipeline/InternalExtendedStatsBucket.java | 4 +- .../pipeline/InternalPercentilesBucket.java | 4 +- .../pipeline/InternalSimpleValue.java | 4 +- .../pipeline/InternalStatsBucket.java | 4 +- .../MaxBucketPipelineAggregationBuilder.java | 4 +- .../pipeline/MaxBucketPipelineAggregator.java | 6 +- .../MinBucketPipelineAggregationBuilder.java | 4 +- .../pipeline/MinBucketPipelineAggregator.java | 6 +- .../MovAvgPipelineAggregationBuilder.java | 4 +- .../pipeline/MovAvgPipelineAggregator.java | 6 +- .../MovFnPipelineAggregationBuilder.java | 4 +- .../pipeline/MovFnPipelineAggregator.java | 2 +- ...tilesBucketPipelineAggregationBuilder.java | 4 +- .../PercentilesBucketPipelineAggregator.java | 4 +- .../pipeline/PipelineAggregator.java | 14 +- .../SerialDiffPipelineAggregationBuilder.java | 4 +- .../SerialDiffPipelineAggregator.java | 2 +- .../pipeline/SiblingPipelineAggregator.java | 4 +- ...StatsBucketPipelineAggregationBuilder.java | 4 +- .../StatsBucketPipelineAggregator.java | 4 +- .../SumBucketPipelineAggregationBuilder.java | 4 +- .../pipeline/SumBucketPipelineAggregator.java | 4 +- .../MultiValuesSourceAggregationBuilder.java | 8 +- .../MultiValuesSourceAggregatorFactory.java | 12 +- .../ValuesSourceAggregationBuilder.java | 8 +- .../ValuesSourceAggregatorFactory.java | 14 +- .../search/internal/ShardSearchRequest.java | 18 +- .../snapshots/RestoreService.java | 178 +++---- .../snapshots/SnapshotShardFailure.java | 4 +- .../snapshots/SnapshotsService.java | 80 +-- .../tasks/TaskResultsService.java | 22 +- .../elasticsearch/ExceptionsHelperTests.java | 4 +- .../java/org/elasticsearch/VersionTests.java | 8 +- .../ClusterAllocationExplainIT.java | 18 +- ...AddVotingConfigExclusionsRequestTests.java | 10 +- ...tAddVotingConfigExclusionsActionTests.java | 42 +- ...learVotingConfigExclusionsActionTests.java | 10 +- .../health/ClusterHealthResponsesTests.java | 4 +- .../TransportClusterHealthActionTests.java | 10 +- .../repositories/RepositoryBlocksIT.java | 6 +- .../reroute/ClusterRerouteResponseTests.java | 20 +- .../cluster/reroute/ClusterRerouteTests.java | 14 +- .../settings/SettingsUpdaterTests.java | 138 ++--- .../cluster/snapshots/SnapshotBlocksIT.java | 8 +- .../status/SnapshotIndexShardStatusTests.java | 4 +- .../cluster/state/ClusterStateApiTests.java | 12 +- .../state/ClusterStateRequestTests.java | 14 +- ...ansportClusterStateActionDisruptionIT.java | 26 +- .../cluster/tasks/PendingTasksBlocksIT.java | 10 +- .../indices/TransportAnalyzeActionTests.java | 6 +- .../alias/ValidateIndiesAliasesRequestIT.java | 10 +- .../alias/get/GetAliasesResponseTests.java | 38 +- .../get/TransportGetAliasesActionTests.java | 16 +- .../clear/ClearIndicesCacheBlocksIT.java | 10 +- ...portVerifyShardBeforeCloseActionTests.java | 12 +- .../admin/indices/create/CreateIndexIT.java | 52 +- .../create/CreateIndexRequestTests.java | 2 +- .../admin/indices/create/ShrinkIndexIT.java | 36 +- .../admin/indices/create/SplitIndexIT.java | 18 +- .../CreateDataStreamRequestTests.java | 8 +- .../DeleteDataStreamRequestTests.java | 6 +- .../GetDataStreamsRequestTests.java | 4 +- .../indices/delete/DeleteIndexBlocksIT.java | 26 +- .../admin/indices/flush/FlushBlocksIT.java | 10 +- .../forcemerge/ForceMergeBlocksIT.java | 10 +- .../indices/forcemerge/ForceMergeIT.java | 6 +- .../action/admin/indices/get/GetIndexIT.java | 34 +- .../indices/get/GetIndexResponseTests.java | 38 +- .../get/GetFieldMappingsResponseTests.java | 44 +- .../mapping/get/GetMappingsResponseTests.java | 18 +- .../indices/refresh/RefreshBlocksIT.java | 10 +- ...java => MetadataRolloverServiceTests.java} | 144 +++--- .../admin/indices/rollover/RolloverIT.java | 54 +- .../TransportRolloverActionTests.java | 84 +-- .../segments/IndicesSegmentsBlocksIT.java | 10 +- .../get/GetSettingsResponseTests.java | 4 +- .../shards/IndicesShardStoreRequestIT.java | 12 +- .../indices/shrink/ResizeRequestTests.java | 2 +- .../shrink/TransportResizeActionTests.java | 18 +- .../indices/stats/IndicesStatsBlocksIT.java | 16 +- .../get/GetIndexTemplatesResponseTests.java | 14 +- .../action/bulk/BulkIntegrationIT.java | 4 +- .../action/bulk/BulkProcessorIT.java | 4 +- .../action/bulk/BulkWithUpdatesIT.java | 6 +- ...ActionIndicesThatCannotBeCreatedTests.java | 4 +- .../bulk/TransportBulkActionIngestTests.java | 40 +- .../action/bulk/TransportBulkActionTests.java | 60 +-- .../bulk/TransportShardBulkActionTests.java | 16 +- .../action/delete/DeleteResponseTests.java | 2 +- .../get/TransportMultiGetActionTests.java | 14 +- .../action/index/IndexResponseTests.java | 2 +- .../ingest/SimulateExecutionServiceTests.java | 2 +- .../SimulatePipelineRequestParsingTests.java | 20 +- .../ingest/WriteableIngestDocumentTests.java | 16 +- ...TransportResyncReplicationActionTests.java | 12 +- .../action/search/SearchResponseTests.java | 4 +- .../search/ShardSearchFailureTests.java | 4 +- .../search/TransportSearchActionTests.java | 8 +- .../action/search/TransportSearchIT.java | 6 +- .../action/support/ActiveShardCountTests.java | 24 +- .../support/ActiveShardsObserverIT.java | 6 +- .../action/support/AutoCreateIndexTests.java | 22 +- .../TransportBroadcastByNodeActionTests.java | 10 +- .../ReplicationOperationTests.java | 30 +- ...tReplicationActionRetryOnClosedNodeIT.java | 6 +- .../TransportReplicationActionTests.java | 64 +-- ...ReplicationAllPermitsAcquisitionTests.java | 22 +- .../TransportWriteActionTests.java | 18 +- .../TransportMultiTermVectorsActionTests.java | 14 +- .../action/update/UpdateResponseTests.java | 2 +- .../elasticsearch/aliases/IndexAliasesIT.java | 88 ++-- .../elasticsearch/blocks/SimpleBlocksIT.java | 10 +- .../bootstrap/BootstrapChecksTests.java | 8 +- .../bootstrap/MaxMapCountCheckTests.java | 6 +- .../documentation/IndicesDocumentationIT.java | 6 +- .../cluster/ClusterChangedEventTests.java | 180 +++---- .../cluster/ClusterHealthIT.java | 6 +- .../cluster/ClusterInfoServiceIT.java | 4 +- .../cluster/ClusterModuleTests.java | 20 +- .../cluster/ClusterStateDiffIT.java | 148 +++--- .../elasticsearch/cluster/ClusterStateIT.java | 36 +- .../cluster/ClusterStateTests.java | 64 +-- .../cluster/FeatureAwareTests.java | 10 +- .../cluster/MinimumMasterNodesIT.java | 16 +- .../elasticsearch/cluster/NoMasterNodeIT.java | 6 +- .../cluster/SimpleClusterStateIT.java | 76 +-- .../cluster/SimpleDataNodesIT.java | 6 +- ...rdFailedClusterStateTaskExecutorTests.java | 30 +- ...dStartedClusterStateTaskExecutorTests.java | 36 +- .../action/shard/ShardStateActionTests.java | 4 +- .../allocation/AwarenessAllocationIT.java | 14 +- .../cluster/allocation/ClusterRerouteIT.java | 28 +- .../allocation/FilteringAllocationIT.java | 14 +- .../allocation/SimpleAllocationIT.java | 2 +- .../ClusterFormationFailureHelperTests.java | 16 +- ...ts.java => CoordinationMetadataTests.java} | 22 +- .../coordination/CoordinationStateTests.java | 16 +- .../coordination/CoordinatorTests.java | 16 +- .../ElasticsearchNodeCommandTests.java | 30 +- .../cluster/coordination/JoinHelperTests.java | 10 +- .../coordination/JoinTaskExecutorTests.java | 40 +- .../cluster/coordination/MessagesTests.java | 4 +- .../cluster/coordination/NodeJoinTests.java | 10 +- .../coordination/PreVoteCollectorTests.java | 2 +- .../coordination/PublicationTests.java | 4 +- .../PublicationTransportHandlerTests.java | 2 +- .../coordination/RareClusterStateIT.java | 36 +- .../coordination/ReconfiguratorTests.java | 2 +- .../coordination/RemoveCustomsCommandIT.java | 6 +- .../coordination/RemoveSettingsCommandIT.java | 6 +- .../UnsafeBootstrapAndDetachCommandIT.java | 18 +- .../coordination/VotingConfigurationIT.java | 4 +- .../cluster/coordination/Zen1IT.java | 20 +- .../cluster/coordination/ZenDiscoveryIT.java | 20 +- .../health/ClusterHealthAllocationTests.java | 16 +- .../health/ClusterIndexHealthTests.java | 20 +- .../health/ClusterStateHealthTests.java | 54 +- ...DataTests.java => AliasMetadataTests.java} | 28 +- .../metadata/AutoExpandReplicasTests.java | 10 +- .../metadata/ComponentTemplateTests.java | 6 +- .../HumanReadableIndexSettingsTests.java | 14 +- .../metadata/IndexAbstractionTests.java | 24 +- ...DataTests.java => IndexMetadataTests.java} | 148 +++--- .../IndexNameExpressionResolverTests.java | 366 +++++++------- ...s.java => IndexTemplateMetadataTests.java} | 38 +- .../metadata/IndexTemplateV2Tests.java | 6 +- ...a => MetadataCreateIndexServiceTests.java} | 228 ++++----- ...a => MetadataDeleteIndexServiceTests.java} | 18 +- ... => MetadataIndexAliasesServiceTests.java} | 150 +++--- ...va => MetadataIndexStateServiceTests.java} | 182 +++---- ...va => MetadataIndexStateServiceUtils.java} | 12 +- ...=> MetadataIndexTemplateServiceTests.java} | 202 ++++---- ... => MetadataIndexUpgradeServiceTests.java} | 102 ++-- ....java => MetadataMappingServiceTests.java} | 32 +- ...{MetaDataTests.java => MetadataTests.java} | 478 +++++++++--------- .../metadata/TemplateUpgradeServiceIT.java | 26 +- .../metadata/TemplateUpgradeServiceTests.java | 40 +- ...s.java => ToAndFromJsonMetadataTests.java} | 180 +++---- .../metadata/UpgradeIndexSettingsIT.java | 6 +- .../WildcardExpressionResolverTests.java | 74 +-- .../cluster/routing/AllocationIdIT.java | 8 +- .../cluster/routing/DelayedAllocationIT.java | 22 +- .../DelayedAllocationServiceTests.java | 46 +- .../routing/OperationRoutingTests.java | 46 +- .../cluster/routing/PrimaryAllocationIT.java | 32 +- .../cluster/routing/PrimaryTermsTests.java | 34 +- .../cluster/routing/RoutingNodeTests.java | 26 +- .../routing/RoutingTableGenerator.java | 16 +- .../cluster/routing/RoutingTableTests.java | 82 +-- .../cluster/routing/ShardRoutingTests.java | 2 +- .../cluster/routing/UnassignedInfoTests.java | 98 ++-- .../allocation/AddIncrementallyTests.java | 28 +- .../allocation/AllocationCommandsTests.java | 78 +-- .../allocation/AllocationPriorityTests.java | 20 +- .../allocation/AwarenessAllocationTests.java | 108 ++-- .../allocation/BalanceConfigurationTests.java | 28 +- .../BalanceUnbalancedClusterTests.java | 12 +- .../allocation/CatAllocationTestCase.java | 14 +- .../ClusterRebalanceRoutingTests.java | 102 ++-- .../ConcurrentRebalanceRoutingTests.java | 12 +- .../allocation/DeadNodesAllocationTests.java | 28 +- .../DecisionsImpactOnClusterHealthTests.java | 12 +- .../allocation/DiskThresholdMonitorTests.java | 60 +-- ...ReplicaAsPrimaryDuringRelocationTests.java | 12 +- .../ExpectedShardSizeAllocationTests.java | 24 +- .../allocation/FailedNodeRoutingTests.java | 22 +- .../allocation/FailedShardsRoutingTests.java | 78 +-- .../allocation/FilterRoutingTests.java | 46 +- .../allocation/InSyncAllocationIdTests.java | 88 ++-- .../routing/allocation/IndexBalanceTests.java | 38 +- .../MaxRetryAllocationDeciderTests.java | 20 +- .../NodeVersionAllocationDeciderTests.java | 56 +- ...alPrimariesToRelocatingPrimariesTests.java | 24 +- .../PreferPrimaryAllocationTests.java | 28 +- .../PrimaryElectionRoutingTests.java | 28 +- ...yNotRelocatedWhileBeingRecoveredTests.java | 12 +- .../RandomAllocationDeciderTests.java | 16 +- .../allocation/RebalanceAfterActiveTests.java | 12 +- .../ReplicaAllocatedAfterPrimaryTests.java | 12 +- .../ResizeAllocationDeciderTests.java | 66 +-- .../RetryFailedAllocationTests.java | 10 +- .../RoutingNodesIntegrityTests.java | 44 +- .../allocation/SameShardRoutingTests.java | 14 +- .../routing/allocation/ShardStateIT.java | 16 +- .../allocation/ShardVersioningTests.java | 16 +- .../ShardsLimitAllocationTests.java | 62 +-- .../SingleShardNoReplicasRoutingTests.java | 42 +- .../SingleShardOneReplicaRoutingTests.java | 12 +- .../allocation/StartedShardsRoutingTests.java | 16 +- .../TenShardsOneReplicaRoutingTests.java | 12 +- .../allocation/ThrottlingAllocationTests.java | 72 +-- .../TrackFailedAllocationNodesTests.java | 10 +- .../UpdateNumberOfReplicasTests.java | 24 +- .../decider/AllocationDecidersTests.java | 10 +- .../decider/DiskThresholdDeciderTests.java | 68 +-- .../DiskThresholdDeciderUnitTests.java | 84 +-- .../EnableAllocationShortCircuitTests.java | 38 +- .../decider/EnableAllocationTests.java | 74 +-- .../decider/FilterAllocationDeciderTests.java | 40 +- .../allocation/decider/MockDiskUsagesIT.java | 12 +- ...storeInProgressAllocationDeciderTests.java | 16 +- .../UpdateShardAllocationSettingsIT.java | 14 +- .../ClusterSerializationTests.java | 54 +- .../ClusterStateToStringTests.java | 16 +- .../service/ClusterApplierServiceTests.java | 4 +- .../cluster/settings/ClusterSettingsIT.java | 20 +- .../cluster/shards/ClusterSearchShardsIT.java | 10 +- .../cluster/shards/ClusterShardLimitIT.java | 22 +- .../structure/RoutingIteratorTests.java | 62 +-- .../elasticsearch/common/ChannelsTests.java | 4 +- .../common/geo/GeoJsonShapeParserTests.java | 10 +- .../common/geo/GeoWKTShapeParserTests.java | 34 +- .../common/settings/ConsistentSettingsIT.java | 18 +- .../common/settings/ScopedSettingsTests.java | 28 +- .../common/settings/SettingTests.java | 8 +- .../common/settings/UpgradeSettingsIT.java | 20 +- .../common/xcontent/BaseXContentTestCase.java | 6 +- .../ClusterDisruptionCleanSettingsIT.java | 6 +- .../discovery/ClusterDisruptionIT.java | 18 +- .../discovery/DiscoveryDisruptionIT.java | 6 +- .../discovery/DiskDisruptionIT.java | 6 +- .../discovery/MasterDisruptionIT.java | 12 +- .../discovery/SnapshotDisruptionIT.java | 14 +- .../single/SingleNodeDiscoveryIT.java | 4 +- .../zen/NodeJoinControllerTests.java | 22 +- .../zen/PublishClusterStateActionTests.java | 56 +- .../discovery/zen/ZenDiscoveryUnitTests.java | 24 +- .../elasticsearch/document/ShardInfoIT.java | 6 +- .../elasticsearch/env/NodeEnvironmentIT.java | 6 +- .../env/NodeEnvironmentTests.java | 20 +- ...aDataTests.java => NodeMetadataTests.java} | 50 +- .../env/NodeRepurposeCommandTests.java | 8 +- .../env/OverrideNodeVersionCommandTests.java | 34 +- .../gateway/ClusterStateUpdatersTests.java | 194 +++---- .../gateway/DanglingIndicesStateTests.java | 78 +-- .../gateway/GatewayIndexStateIT.java | 86 ++-- .../GatewayMetaStatePersistedStateTests.java | 142 +++--- .../gateway/GatewayMetaStateTests.java | 168 +++--- .../IncrementalClusterStateWriterTests.java | 178 +++---- .../gateway/MetaStateServiceTests.java | 134 ++--- ...sts.java => MetadataStateFormatTests.java} | 32 +- ...sIT.java => MetadataWriteDataNodesIT.java} | 32 +- .../PersistedClusterStateServiceTests.java | 250 ++++----- .../gateway/PrimaryShardAllocatorTests.java | 24 +- .../gateway/PriorityComparatorTests.java | 22 +- .../gateway/RecoveryFromGatewayIT.java | 32 +- .../gateway/ReplicaShardAllocatorIT.java | 28 +- .../gateway/ReplicaShardAllocatorTests.java | 122 ++--- .../elasticsearch/get/LegacyGetActionIT.java | 6 +- .../elasticsearch/index/HiddenIndexIT.java | 8 +- .../elasticsearch/index/IndexModuleTests.java | 22 +- .../index/IndexServiceTests.java | 14 +- .../index/IndexSettingsTests.java | 266 +++++----- .../index/IndexSortSettingsTests.java | 4 +- .../index/IndexingSlowLogTests.java | 96 ++-- .../index/MergePolicySettingsTests.java | 26 +- .../index/MergeSchedulerSettingsTests.java | 42 +- .../index/SearchSlowLogTests.java | 100 ++-- .../index/analysis/AnalysisRegistryTests.java | 26 +- .../index/analysis/PreBuiltAnalyzerTests.java | 4 +- .../PreConfiguredTokenFilterTests.java | 14 +- .../ReloadableCustomAnalyzerTests.java | 4 +- .../index/analysis/StopAnalyzerTests.java | 4 +- .../index/engine/InternalEngineMergeIT.java | 6 +- .../index/engine/InternalEngineTests.java | 102 ++-- .../index/engine/NoOpEngineRecoveryTests.java | 2 +- .../index/engine/NoOpEngineTests.java | 6 +- .../index/fielddata/FieldDataCacheTests.java | 8 +- .../FieldStatsProviderRefreshTests.java | 4 +- .../index/mapper/AllFieldMapperTests.java | 4 +- .../index/mapper/DateFieldTypeTests.java | 20 +- .../mapper/DocumentFieldMapperTests.java | 4 +- .../index/mapper/DocumentParserTests.java | 6 +- .../index/mapper/DynamicMappingIT.java | 6 +- .../index/mapper/DynamicMappingTests.java | 10 +- .../mapper/ExternalFieldMapperTests.java | 4 +- .../mapper/FieldFilterMapperPluginTests.java | 52 +- .../mapper/FieldNamesFieldTypeTests.java | 4 +- .../index/mapper/IdFieldTypeTests.java | 16 +- .../index/mapper/IndexFieldTypeTests.java | 8 +- .../mapper/LegacyDynamicMappingTests.java | 4 +- .../mapper/LegacyMapperServiceTests.java | 10 +- .../mapper/LegacyTypeFieldMapperTests.java | 4 +- .../index/mapper/MapperServiceTests.java | 6 +- .../index/mapper/MapperTests.java | 4 +- .../mapper/MultiFieldsIntegrationIT.java | 32 +- .../index/mapper/NestedObjectMapperTests.java | 6 +- .../index/mapper/ObjectMapperMergeTests.java | 2 +- .../index/mapper/RangeFieldTypeTests.java | 4 +- .../index/mapper/RootObjectMapperTests.java | 4 +- .../index/mapper/TypeFieldTypeTests.java | 14 +- .../index/mapper/TypeParsersTests.java | 6 +- .../index/mapper/UpdateMappingTests.java | 10 +- .../query/GeoShapeQueryBuilderTests.java | 4 +- .../index/query/IdsQueryBuilderTests.java | 4 +- .../query/LegacyGeoShapeFieldQueryTests.java | 4 +- .../query/MoreLikeThisQueryBuilderTests.java | 10 +- .../query/MultiMatchQueryBuilderTests.java | 14 +- .../index/query/QueryShardContextTests.java | 20 +- .../query/QueryStringQueryBuilderTests.java | 16 +- .../query/SearchIndexNameMatcherTests.java | 22 +- .../query/SimpleQueryStringBuilderTests.java | 12 +- .../query/SpanTermQueryBuilderTests.java | 2 +- .../ScoreFunctionBuilderTests.java | 8 +- .../IndexLevelReplicationTests.java | 20 +- .../RecoveryDuringReplicationTests.java | 20 +- .../RetentionLeasesReplicationTests.java | 12 +- .../PeerRecoveryRetentionLeaseCreationIT.java | 12 +- .../index/seqno/RetentionLeasesTests.java | 2 +- .../index/shard/IndexShardIT.java | 26 +- .../index/shard/IndexShardTests.java | 314 ++++++------ .../index/shard/NewPathForShardTests.java | 6 +- .../RemoveCorruptedShardDataCommandIT.java | 18 +- .../RemoveCorruptedShardDataCommandTests.java | 26 +- .../index/shard/ShardGetServiceTests.java | 32 +- .../index/shard/ShardIdTests.java | 6 +- .../index/shard/ShardPathTests.java | 16 +- .../index/shard/ShardSplittingQueryTests.java | 40 +- .../index/shard/StoreRecoveryTests.java | 12 +- .../similarity/LegacySimilarityTests.java | 6 +- .../snapshots/blobstore/FileInfoTests.java | 14 +- .../index/store/CorruptedFileIT.java | 32 +- .../index/store/FsDirectoryFactoryTests.java | 4 +- .../elasticsearch/index/store/StoreTests.java | 78 +-- .../index/suggest/stats/SuggestStatsIT.java | 4 +- .../index/translog/TranslogTests.java | 8 +- .../elasticsearch/indexing/IndexActionIT.java | 10 +- .../IndexLifecycleActionIT.java | 4 +- ...DateMathIndexExpressionsIntegrationIT.java | 20 +- .../indices/IndexingMemoryControllerIT.java | 2 +- .../indices/IndicesLifecycleListenerIT.java | 10 +- ...dicesLifecycleListenerSingleNodeTests.java | 10 +- .../indices/IndicesModuleTests.java | 6 +- .../indices/IndicesRequestCacheIT.java | 22 +- .../indices/IndicesServiceCloseTests.java | 4 +- .../indices/IndicesServiceTests.java | 136 ++--- .../indices/analysis/AnalysisModuleTests.java | 20 +- ...actIndicesClusterStateServiceTestCase.java | 30 +- .../indices/cluster/ClusterStateChanges.java | 52 +- ...ClusterStateServiceRandomUpdatesTests.java | 58 +-- .../exists/indices/IndicesExistsIT.java | 16 +- .../indices/exists/types/TypesExistsIT.java | 12 +- .../elasticsearch/indices/flush/FlushIT.java | 26 +- .../flush/SyncedFlushSingleNodeTests.java | 6 +- .../LegacyUpdateMappingIntegrationIT.java | 4 +- .../mapping/SimpleGetFieldMappingsIT.java | 16 +- .../indices/mapping/SimpleGetMappingsIT.java | 10 +- .../mapping/UpdateMappingIntegrationIT.java | 22 +- .../memory/breaker/CircuitBreakerNoopIT.java | 2 +- .../breaker/CircuitBreakerServiceIT.java | 10 +- .../indices/recovery/IndexRecoveryIT.java | 70 +-- .../PeerRecoveryTargetServiceTests.java | 26 +- .../recovery/RecoverySourceHandlerTests.java | 70 +-- .../indices/recovery/RecoveryStatusTests.java | 6 +- .../indices/recovery/RecoveryTests.java | 26 +- .../recovery/ReplicaToPrimaryPromotionIT.java | 10 +- .../indices/settings/GetSettingsBlocksIT.java | 10 +- .../InternalOrPrivateSettingsPlugin.java | 12 +- .../settings/UpdateNumberOfReplicasIT.java | 34 +- .../indices/settings/UpdateSettingsIT.java | 92 ++-- .../state/CloseIndexDisableCloseAllIT.java | 8 +- .../indices/state/CloseIndexIT.java | 58 +-- .../state/CloseWhileRelocatingShardsIT.java | 2 +- .../indices/state/OpenCloseIndexIT.java | 22 +- .../indices/state/ReopenWhileClosingIT.java | 6 +- .../indices/state/SimpleIndexStateIT.java | 10 +- .../indices/stats/IndexStatsIT.java | 12 +- .../indices/stats/LegacyIndexStatsIT.java | 4 +- .../store/IndicesStoreIntegrationIT.java | 34 +- .../template/SimpleIndexTemplateIT.java | 34 +- .../ingest/IngestDocumentTests.java | 8 +- .../ingest/IngestMetadataTests.java | 4 +- .../ingest/IngestServiceTests.java | 24 +- .../org/elasticsearch/mget/SimpleMgetIT.java | 4 +- .../org/elasticsearch/node/NodeTests.java | 4 +- .../DestructiveOperationsIT.java | 10 +- .../PersistentTasksClusterServiceTests.java | 184 +++---- ...> PersistentTasksCustomMetadataTests.java} | 90 ++-- .../PersistentTasksDecidersTestCase.java | 18 +- .../PersistentTasksExecutorFullRestartIT.java | 12 +- .../persistent/PersistentTasksExecutorIT.java | 16 +- .../PersistentTasksExecutorResponseTests.java | 6 +- .../PersistentTasksNodeServiceTests.java | 50 +- .../persistent/TestPersistentTasksPlugin.java | 4 +- .../decider/EnableAssignmentDeciderIT.java | 10 +- .../recovery/FullRollingRestartIT.java | 6 +- .../recovery/RecoveryWhileUnderLoadIT.java | 10 +- .../elasticsearch/recovery/RelocationIT.java | 12 +- .../recovery/TruncatedRecoveryIT.java | 8 +- .../repositories/RepositoriesServiceIT.java | 10 +- .../RepositoriesServiceTests.java | 24 +- .../BlobStoreRepositoryRestoreTests.java | 18 +- .../blobstore/BlobStoreRepositoryTests.java | 6 +- .../repositories/fs/FsRepositoryTests.java | 10 +- .../rest/action/RestActionsTests.java | 4 +- .../RestClusterGetSettingsActionTests.java | 12 +- .../indices/RestGetAliasesActionTests.java | 34 +- .../action/cat/RestIndicesActionTests.java | 32 +- .../routing/AliasResolveRoutingIT.java | 22 +- .../elasticsearch/routing/AliasRoutingIT.java | 4 +- ...ataTests.java => ScriptMetadataTests.java} | 66 +-- .../script/ScriptServiceTests.java | 26 +- .../script/StoredScriptTests.java | 6 +- .../search/DefaultSearchContextTests.java | 12 +- .../search/SearchModuleTests.java | 10 +- .../aggregations/FiltersAggsRewriteIT.java | 4 +- .../{MetaDataIT.java => MetadataIT.java} | 36 +- .../aggregations/TestAggregatorFactory.java | 6 +- .../bucket/DiversifiedSamplerIT.java | 4 +- .../aggregations/bucket/FiltersTests.java | 2 +- .../aggregations/bucket/GeoDistanceIT.java | 4 +- .../aggregations/bucket/GeoHashGridIT.java | 4 +- .../search/aggregations/bucket/NestedIT.java | 4 +- .../aggregations/bucket/ReverseNestedIT.java | 4 +- .../search/aggregations/bucket/SamplerIT.java | 4 +- .../SignificantTermsSignificanceScoreIT.java | 4 +- .../bucket/TermsDocCountErrorIT.java | 10 +- .../bucket/TermsShardMinDocCountIT.java | 4 +- ...djacencyMatrixAggregationBuilderTests.java | 12 +- .../InternalAdjacencyMatrixTests.java | 16 +- .../composite/InternalCompositeTests.java | 16 +- .../bucket/filter/InternalFilterTests.java | 4 +- .../bucket/filter/InternalFiltersTests.java | 16 +- .../bucket/geogrid/GeoGridTestCase.java | 18 +- .../bucket/geogrid/GeoHashGridTests.java | 4 +- .../bucket/geogrid/GeoTileGridTests.java | 4 +- .../bucket/global/InternalGlobalTests.java | 4 +- .../AutoDateHistogramAggregatorTests.java | 4 +- .../bucket/histogram/ExtendedBoundsTests.java | 8 +- .../InternalAutoDateHistogramTests.java | 16 +- .../histogram/InternalDateHistogramTests.java | 16 +- .../histogram/InternalHistogramTests.java | 18 +- .../bucket/missing/InternalMissingTests.java | 4 +- .../bucket/nested/InternalNestedTests.java | 4 +- .../nested/InternalReverseNestedTests.java | 4 +- .../range/InternalBinaryRangeTests.java | 16 +- .../bucket/range/InternalDateRangeTests.java | 16 +- .../range/InternalGeoDistanceTests.java | 16 +- .../bucket/range/InternalRangeTestCase.java | 6 +- .../bucket/range/InternalRangeTests.java | 16 +- .../bucket/sampler/InternalSamplerTests.java | 4 +- .../InternalSignificantTermsTestCase.java | 12 +- .../SignificantLongTermsTests.java | 30 +- .../SignificantStringTermsTests.java | 30 +- .../bucket/terms/DoubleTermsTests.java | 28 +- .../bucket/terms/InternalTermsTestCase.java | 12 +- .../bucket/terms/LongTermsTests.java | 28 +- .../terms/RareTermsAggregatorTests.java | 4 +- .../bucket/terms/StringTermsTests.java | 28 +- .../metrics/AbstractPercentilesTestCase.java | 6 +- .../metrics/InternalAvgTests.java | 16 +- .../metrics/InternalCardinalityTests.java | 16 +- .../metrics/InternalExtendedStatsTests.java | 20 +- .../metrics/InternalGeoBoundsTests.java | 14 +- .../metrics/InternalGeoCentroidTests.java | 14 +- .../InternalHDRPercentilesRanksTests.java | 12 +- .../metrics/InternalHDRPercentilesTests.java | 16 +- .../metrics/InternalMaxTests.java | 16 +- .../InternalMedianAbsoluteDeviationTests.java | 16 +- .../metrics/InternalMinTests.java | 16 +- .../metrics/InternalScriptedMetricTests.java | 18 +- .../metrics/InternalStatsBucketTests.java | 4 +- .../metrics/InternalStatsTests.java | 20 +- .../metrics/InternalSumTests.java | 16 +- .../InternalTDigestPercentilesRanksTests.java | 12 +- .../InternalTDigestPercentilesTests.java | 16 +- .../metrics/InternalTopHitsTests.java | 16 +- .../metrics/InternalValueCountTests.java | 16 +- .../metrics/InternalWeightedAvgTests.java | 16 +- .../metrics/MedianAbsoluteDeviationIT.java | 4 +- .../metrics/MinAggregatorTests.java | 4 +- .../pipeline/BucketHelpersTests.java | 4 +- .../InternalBucketMetricValueTests.java | 16 +- .../pipeline/InternalDerivativeTests.java | 16 +- .../InternalExtendedStatsBucketTests.java | 2 +- .../InternalPercentilesBucketTests.java | 24 +- .../pipeline/InternalSimpleValueTests.java | 16 +- .../basic/TransportTwoNodesSearchIT.java | 2 +- .../highlight/HighlightBuilderTests.java | 4 +- .../search/fields/SearchFieldsIT.java | 2 +- .../functionscore/DecayFunctionScoreIT.java | 6 +- .../search/functionscore/QueryRescorerIT.java | 4 +- .../search/geo/GeoBoundingBoxQueryIT.java | 8 +- .../search/geo/GeoDistanceIT.java | 4 +- .../elasticsearch/search/geo/GeoFilterIT.java | 4 +- .../search/geo/GeoPolygonIT.java | 4 +- .../internal/ShardSearchRequestTests.java | 66 +-- .../search/morelikethis/MoreLikeThisIT.java | 4 +- .../search/preference/SearchPreferenceIT.java | 6 +- .../search/query/MultiMatchQueryIT.java | 4 +- .../search/query/SearchQueryIT.java | 2 +- .../rescore/QueryRescorerBuilderTests.java | 6 +- .../search/scroll/DuelScrollIT.java | 6 +- .../search/scroll/SearchScrollIT.java | 16 +- .../search/simple/SimpleSearchIT.java | 4 +- .../search/slice/SliceBuilderTests.java | 14 +- .../search/sort/AbstractSortTestCase.java | 4 +- .../search/sort/FieldSortIT.java | 8 +- .../search/sort/GeoDistanceIT.java | 10 +- .../search/sort/GeoDistanceSortBuilderIT.java | 8 +- .../search/stats/SearchStatsIT.java | 4 +- .../AbstractSuggestionBuilderTestCase.java | 4 +- .../suggest/CompletionSuggestSearchIT.java | 4 +- .../search/suggest/SuggestSearchIT.java | 4 +- .../AbstractSnapshotIntegTestCase.java | 6 +- .../snapshots/BlobStoreFormatIT.java | 4 +- .../snapshots/BlobStoreIncrementalityIT.java | 8 +- .../CorruptedBlobStoreRepositoryIT.java | 10 +- .../DedicatedClusterSnapshotRestoreIT.java | 106 ++-- ...etadataLoadingDuringSnapshotRestoreIT.java | 16 +- .../snapshots/RepositoriesIT.java | 40 +- ...positoriesMetadataSerializationTests.java} | 46 +- .../RepositoryFilterUserMetadataIT.java | 18 +- .../SharedClusterSnapshotRestoreIT.java | 92 ++-- .../snapshots/SnapshotResiliencyTests.java | 48 +- .../MockEventuallyConsistentRepository.java | 18 +- ...ckEventuallyConsistentRepositoryTests.java | 26 +- .../validate/SimpleValidateQueryIT.java | 2 +- .../ConcurrentSeqNoVersioningIT.java | 6 +- .../versioning/SimpleVersioningIT.java | 6 +- .../ClusterStateCreationUtils.java | 70 +-- .../AbstractCoordinatorTestCase.java | 38 +- .../CoordinationStateTestCluster.java | 44 +- .../cluster/routing/TestShardRouting.java | 10 +- .../gateway/MockGatewayMetaState.java | 16 +- .../elasticsearch/index/MapperTestUtils.java | 6 +- .../index/RandomCreateIndexGenerator.java | 8 +- .../index/analysis/AnalysisTestsHelper.java | 6 +- .../index/engine/EngineTestCase.java | 12 +- .../index/mapper/MockFieldMapper.java | 4 +- .../ESIndexLevelReplicationTestCase.java | 48 +- .../index/shard/IndexShardTestCase.java | 58 +-- .../index/shard/RestoreOnlyRepository.java | 16 +- .../indices/recovery/AsyncRecoveryTarget.java | 10 +- .../AbstractThirdPartyRepositoryTestCase.java | 8 +- .../blobstore/BlobStoreTestUtil.java | 36 +- .../ESBlobStoreRepositoryIntegTestCase.java | 12 +- ...ESMockAPIBasedRepositoryIntegTestCase.java | 6 +- .../aggregations/AggregatorTestCase.java | 4 +- .../aggregations/BaseAggregationTestCase.java | 2 +- .../BasePipelineAggregationTestCase.java | 4 +- ...ternalSingleBucketAggregationTestCase.java | 18 +- .../mockstore/BlobContainerWrapper.java | 6 +- .../snapshots/mockstore/MockRepository.java | 20 +- .../test/AbstractBootstrapCheckTestCase.java | 8 +- .../test/AbstractBuilderTestCase.java | 8 +- ...AbstractDiffableSerializationTestCase.java | 2 +- .../elasticsearch/test/ESIntegTestCase.java | 72 +-- .../test/ESSingleNodeTestCase.java | 20 +- .../org/elasticsearch/test/ESTestCase.java | 6 +- .../test/ESTokenStreamTestCase.java | 4 +- .../test/IndexSettingsModule.java | 28 +- .../test/InternalAggregationTestCase.java | 30 +- ...nternalMultiBucketAggregationTestCase.java | 8 +- .../test/InternalSettingsPlugin.java | 4 +- .../test/InternalTestCluster.java | 4 +- .../org/elasticsearch/test/RandomObjects.java | 2 +- .../org/elasticsearch/test/TestCluster.java | 10 +- ...mMetaData.java => TestCustomMetadata.java} | 16 +- .../test/gateway/TestGatewayAllocator.java | 4 +- .../hamcrest/ElasticsearchAssertions.java | 14 +- .../test/store/MockFSDirectoryFactory.java | 6 +- .../FakeThreadPoolMasterServiceTests.java | 20 +- .../search/MockSearchServiceTests.java | 6 +- .../ElasticsearchAssertionsTests.java | 10 +- .../smoketest/XDocsClientYamlTestSuiteIT.java | 4 +- .../boxplot/BoxplotAggregationBuilder.java | 10 +- .../analytics/boxplot/BoxplotAggregator.java | 8 +- .../boxplot/BoxplotAggregatorFactory.java | 12 +- .../analytics/boxplot/InternalBoxplot.java | 6 +- ...CardinalityPipelineAggregationBuilder.java | 4 +- ...mulativeCardinalityPipelineAggregator.java | 2 +- .../InternalSimpleLongValue.java | 4 +- .../stringstats/InternalStringStats.java | 6 +- .../StringStatsAggregationBuilder.java | 10 +- .../stringstats/StringStatsAggregator.java | 8 +- .../StringStatsAggregatorFactory.java | 12 +- .../topmetrics/InternalTopMetrics.java | 14 +- .../TopMetricsAggregationBuilder.java | 10 +- .../topmetrics/TopMetricsAggregator.java | 8 +- .../TopMetricsAggregatorFactory.java | 8 +- .../TransportAnalyticsStatsActionTests.java | 6 +- .../boxplot/InternalBoxplotTests.java | 16 +- .../stringstats/InternalStringStatsTests.java | 8 +- .../topmetrics/InternalTopMetricsTests.java | 10 +- .../xpack/search/AsyncSearchIndexService.java | 6 +- .../search/AsyncSearchIndexServiceTests.java | 6 +- .../search/CancellingAggregationBuilder.java | 6 +- .../java/org/elasticsearch/xpack/ccr/Ccr.java | 4 +- .../xpack/ccr/CcrLicenseChecker.java | 26 +- .../ccr/action/AutoFollowCoordinator.java | 54 +- .../xpack/ccr/action/CcrRequests.java | 42 +- .../xpack/ccr/action/ShardChangesAction.java | 24 +- .../ccr/action/ShardFollowTaskCleaner.java | 14 +- .../ccr/action/ShardFollowTasksExecutor.java | 86 ++-- ...nsportActivateAutoFollowPatternAction.java | 6 +- ...ransportDeleteAutoFollowPatternAction.java | 6 +- .../ccr/action/TransportFollowInfoAction.java | 12 +- .../action/TransportFollowStatsAction.java | 14 +- .../action/TransportForgetFollowerAction.java | 2 +- .../TransportGetAutoFollowPatternAction.java | 8 +- .../action/TransportPauseFollowAction.java | 14 +- .../TransportPutAutoFollowPatternAction.java | 26 +- .../ccr/action/TransportPutFollowAction.java | 12 +- .../action/TransportResumeFollowAction.java | 62 +-- .../ccr/action/TransportUnfollowAction.java | 48 +- .../PutCcrRestoreSessionAction.java | 20 +- .../xpack/ccr/repository/CcrRepository.java | 104 ++-- .../repository/CcrRestoreSourceService.java | 6 +- .../elasticsearch/xpack/CcrIntegTestCase.java | 22 +- .../xpack/CcrSingleNodeTestCase.java | 4 +- .../elasticsearch/xpack/ccr/AutoFollowIT.java | 82 +-- .../xpack/ccr/CCRFeatureSetTests.java | 18 +- .../elasticsearch/xpack/ccr/CcrAliasesIT.java | 46 +- .../elasticsearch/xpack/ccr/CcrLicenseIT.java | 4 +- .../xpack/ccr/CcrRepositoryIT.java | 30 +- .../xpack/ccr/CcrRetentionLeaseIT.java | 48 +- .../org/elasticsearch/xpack/ccr/CcrTests.java | 10 +- .../xpack/ccr/CloseFollowerIndexIT.java | 12 +- .../xpack/ccr/FollowStatsIT.java | 8 +- .../xpack/ccr/FollowerFailOverIT.java | 10 +- .../xpack/ccr/IndexFollowingIT.java | 120 ++--- .../xpack/ccr/LocalIndexFollowingIT.java | 6 +- .../action/AutoFollowCoordinatorTests.java | 194 +++---- .../ccr/action/ShardChangesActionTests.java | 2 +- .../ShardFollowTaskReplicationTests.java | 14 +- ...ardFollowTasksExecutorAssignmentTests.java | 2 +- ...tActivateAutoFollowPatternActionTests.java | 10 +- ...ortDeleteAutoFollowPatternActionTests.java | 10 +- .../TransportFollowInfoActionTests.java | 18 +- .../TransportFollowStatsActionTests.java | 24 +- ...nsportGetAutoFollowPatternActionTests.java | 22 +- ...nsportPutAutoFollowPatternActionTests.java | 32 +- .../TransportResumeFollowActionTests.java | 106 ++-- .../action/TransportUnfollowActionTests.java | 42 +- .../index/engine/FollowingEngineTests.java | 40 +- .../CcrRepositoryRetentionLeaseTests.java | 14 +- .../CcrRestoreSourceServiceTests.java | 18 +- .../collector/ccr/StatsCollectorTests.java | 4 +- .../elasticsearch/license/LicenseService.java | 98 ++-- ...sesMetaData.java => LicensesMetadata.java} | 38 +- .../org/elasticsearch/license/Licensing.java | 10 +- .../license/StartBasicClusterTask.java | 22 +- .../license/StartTrialClusterTask.java | 20 +- .../StartupSelfGeneratedLicenseTask.java | 60 +-- .../TransportGetBasicStatusAction.java | 6 +- .../TransportGetTrialStatusAction.java | 4 +- .../SourceOnlySnapshotRepository.java | 40 +- .../xpack/core/XPackClientPlugin.java | 40 +- .../elasticsearch/xpack/core/XPackPlugin.java | 20 +- .../xpack/core/ccr/AutoFollowMetadata.java | 8 +- .../xpack/core/ccr/CCRFeatureSet.java | 10 +- .../validation/SourceDestValidator.java | 2 +- .../deprecation/DeprecationInfoAction.java | 8 +- .../core/ilm/AbstractUnfollowIndexStep.java | 8 +- .../xpack/core/ilm/AllocateAction.java | 10 +- .../xpack/core/ilm/AllocationRoutedStep.java | 4 +- .../xpack/core/ilm/AsyncActionStep.java | 6 +- .../AsyncRetryDuringSnapshotActionStep.java | 14 +- .../xpack/core/ilm/AsyncWaitStep.java | 4 +- .../xpack/core/ilm/BranchingStep.java | 6 +- .../xpack/core/ilm/CheckShrinkReadyStep.java | 6 +- .../core/ilm/CloseFollowerIndexStep.java | 10 +- .../xpack/core/ilm/CloseIndexStep.java | 8 +- .../core/ilm/CopyExecutionStateStep.java | 22 +- .../xpack/core/ilm/DeleteStep.java | 6 +- .../xpack/core/ilm/ForceMergeAction.java | 4 +- .../xpack/core/ilm/ForceMergeStep.java | 6 +- .../xpack/core/ilm/FreezeStep.java | 6 +- .../core/ilm/IndexLifecycleMetadata.java | 16 +- .../core/ilm/InitializePolicyContextStep.java | 26 +- .../core/ilm/LifecycleExecutionState.java | 12 +- .../xpack/core/ilm/LifecyclePolicy.java | 2 +- .../xpack/core/ilm/OpenFollowerIndexStep.java | 8 +- .../xpack/core/ilm/OpenIndexStep.java | 8 +- .../xpack/core/ilm/ReadOnlyAction.java | 4 +- .../xpack/core/ilm/RolloverStep.java | 20 +- .../xpack/core/ilm/SegmentCountStep.java | 12 +- .../xpack/core/ilm/SetPriorityAction.java | 6 +- .../core/ilm/SetSingleNodeAllocateStep.java | 10 +- .../xpack/core/ilm/ShrinkAction.java | 6 +- .../xpack/core/ilm/ShrinkSetAliasStep.java | 20 +- .../xpack/core/ilm/ShrinkStep.java | 20 +- .../core/ilm/ShrunkShardsAllocatedStep.java | 4 +- .../core/ilm/ShrunkenIndexCheckStep.java | 10 +- .../ilm/UpdateRolloverLifecycleDateStep.java | 24 +- .../xpack/core/ilm/UpdateSettingsStep.java | 6 +- .../core/ilm/WaitForActiveShardsStep.java | 18 +- .../core/ilm/WaitForFollowShardTasksStep.java | 8 +- .../core/ilm/WaitForIndexingCompleteStep.java | 4 +- .../core/ilm/WaitForNoFollowersStep.java | 8 +- .../core/ilm/WaitForRolloverReadyStep.java | 26 +- .../xpack/core/ilm/WaitForSnapshotStep.java | 10 +- .../xpack/core/ml/MlMetadata.java | 16 +- .../elasticsearch/xpack/core/ml/MlTasks.java | 54 +- .../xpack/core/ml/action/OpenJobAction.java | 4 +- .../action/StartDataFrameAnalyticsAction.java | 4 +- .../xpack/core/ml/action/UpdateJobAction.java | 4 +- .../core/ml/annotations/AnnotationIndex.java | 10 +- .../DataFrameAnalyticsTaskState.java | 4 +- .../core/ml/job/config/JobTaskState.java | 2 +- .../persistence/ElasticsearchMappings.java | 20 +- .../xpack/core/ml/utils/MlIndexAndAlias.java | 6 +- .../xpack/core/ml/utils/MlStrings.java | 4 +- .../xpack/core/ml/utils/NameResolver.java | 4 +- .../rollup/action/GetRollupCapsAction.java | 4 +- .../rollup/action/GetRollupJobsAction.java | 8 +- ...{TokenMetaData.java => TokenMetadata.java} | 10 +- .../authc/ldap/LdapRealmSettings.java | 4 +- ...java => LdapMetadataResolverSettings.java} | 4 +- .../authz/permission/IndicesPermission.java | 6 +- .../core/slm/SnapshotLifecycleMetadata.java | 16 +- .../core/slm/SnapshotLifecyclePolicy.java | 2 +- .../slm/history/SnapshotHistoryStore.java | 4 +- .../SnapshotLifecycleTemplateRegistry.java | 4 +- .../core/ssl/TLSLicenseBootstrapCheck.java | 2 +- .../core/template/IndexTemplateRegistry.java | 6 +- .../xpack/core/template/TemplateUtils.java | 14 +- .../transform/TransformFeatureSetUsage.java | 4 +- .../action/GetTransformStatsAction.java | 4 +- .../transform/utils/TransformStrings.java | 4 +- .../xpack/core/upgrade/UpgradeField.java | 6 +- ...cherMetaData.java => WatcherMetadata.java} | 22 +- .../actions/stats/WatcherStatsResponse.java | 18 +- .../AbstractLicenseServiceTestCase.java | 8 +- .../AbstractLicensesIntegrationTestCase.java | 20 +- .../license/LicenseClusterChangeTests.java | 22 +- .../license/LicenseRegistrationTests.java | 66 +-- .../license/LicenseServiceTests.java | 4 +- .../license/LicensesManagerServiceTests.java | 26 +- ...> LicensesMetadataSerializationTests.java} | 84 +-- .../org/elasticsearch/license/TestUtils.java | 6 +- .../snapshots/SourceOnlySnapshotIT.java | 4 +- .../SourceOnlySnapshotShardTests.java | 48 +- .../core/LocalStateCompositeXPackPlugin.java | 6 +- .../xpack/core/XPackPluginTests.java | 4 +- .../validation/SourceDestValidatorTests.java | 42 +- .../DeprecationInfoActionResponseTests.java | 10 +- .../AbstractStepMasterTimeoutTestCase.java | 12 +- .../AbstractUnfollowIndexStepTestCase.java | 4 +- .../xpack/core/ilm/AllocateActionTests.java | 10 +- .../core/ilm/AllocationRoutedStepTests.java | 114 ++--- .../xpack/core/ilm/BranchingStepTests.java | 16 +- .../core/ilm/CheckShrinkReadyStepTests.java | 94 ++-- .../core/ilm/CloseFollowerIndexStepTests.java | 14 +- .../xpack/core/ilm/CloseIndexStepTests.java | 16 +- .../core/ilm/CopyExecutionStateStepTests.java | 28 +- .../xpack/core/ilm/DeleteStepTests.java | 18 +- .../xpack/core/ilm/ForceMergeActionTests.java | 6 +- .../xpack/core/ilm/ForceMergeStepTests.java | 12 +- .../xpack/core/ilm/FreezeStepTests.java | 20 +- .../ilm/InitializePolicyContextStepTests.java | 22 +- .../core/ilm/OpenFollowerIndexStepTests.java | 18 +- .../xpack/core/ilm/OpenIndexStepTests.java | 18 +- .../core/ilm/PauseFollowerIndexStepTests.java | 6 +- .../xpack/core/ilm/ReadOnlyActionTests.java | 4 +- .../xpack/core/ilm/RolloverStepTests.java | 46 +- .../xpack/core/ilm/SegmentCountStepTests.java | 12 +- .../core/ilm/SetPriorityActionTests.java | 8 +- .../ilm/SetSingleNodeAllocateStepTests.java | 148 +++--- .../xpack/core/ilm/ShrinkActionTests.java | 18 +- .../core/ilm/ShrinkSetAliasStepTests.java | 30 +- .../xpack/core/ilm/ShrinkStepTests.java | 32 +- .../ilm/ShrunkShardsAllocatedStepTests.java | 36 +- .../core/ilm/ShrunkenIndexCheckStepTests.java | 46 +- .../ilm/UnfollowFollowIndexStepTests.java | 8 +- .../UpdateRolloverLifecycleDateStepTests.java | 50 +- .../core/ilm/UpdateSettingsStepTests.java | 18 +- .../core/ilm/WaitForActiveShardsTests.java | 50 +- .../ilm/WaitForFollowShardTasksStepTests.java | 8 +- .../core/ilm/WaitForIndexColorStepTests.java | 28 +- .../ilm/WaitForIndexingCompleteStepTests.java | 18 +- .../core/ilm/WaitForNoFollowersStepTests.java | 18 +- .../ilm/WaitForRolloverReadyStepTests.java | 58 +-- .../core/ilm/WaitForSnapshotStepTests.java | 58 +-- .../core/ilm/WaitForYellowStepTests.java | 16 +- .../xpack/core/ml/MlTasksTests.java | 80 +-- .../GetDatafeedStatsActionRequestTests.java | 4 +- .../GetDatafeedsActionRequestTests.java | 4 +- .../action/GetJobStatsActionRequestTests.java | 4 +- .../ml/action/GetJobsActionRequestTests.java | 4 +- .../ElasticsearchMappingsTests.java | 40 +- .../core/ml/utils/MlIndexAndAliasTests.java | 40 +- ...DataTests.java => TokenMetadataTests.java} | 22 +- .../support/mapper/TemplateRoleNameTests.java | 20 +- .../accesscontrol/FieldSubsetReaderTests.java | 30 +- .../authz/permission/LimitedRoleTests.java | 24 +- .../authz/store/ReservedRolesStoreTests.java | 36 +- .../history/SnapshotHistoryStoreTests.java | 44 +- ...napshotLifecycleTemplateRegistryTests.java | 10 +- .../ssl/TLSLicenseBootstrapCheckTests.java | 10 +- .../GetTransformActionRequestTests.java | 4 +- .../GetTransformStatsActionRequestTests.java | 4 +- .../MockDeprecatedAggregationBuilder.java | 8 +- .../deprecation/ClusterDeprecationChecks.java | 18 +- .../xpack/deprecation/DeprecationChecks.java | 4 +- .../deprecation/IndexDeprecationChecks.java | 50 +- .../ClusterDeprecationChecksTests.java | 24 +- .../IndexDeprecationChecksTests.java | 42 +- .../xpack/enrich/EnrichMetadata.java | 8 +- .../xpack/enrich/EnrichPlugin.java | 8 +- .../EnrichPolicyMaintenanceService.java | 14 +- .../enrich/EnrichPolicyReindexPipeline.java | 2 +- .../xpack/enrich/EnrichPolicyRunner.java | 12 +- .../xpack/enrich/EnrichProcessorFactory.java | 12 +- .../xpack/enrich/EnrichStore.java | 20 +- .../enrich/EnrichProcessorFactoryTests.java | 32 +- .../enrich/EnrichStatsCollectorTests.java | 4 +- .../xpack/frozen/FrozenIndicesFeatureSet.java | 6 +- .../action/TransportFreezeIndexAction.java | 30 +- .../engine/FrozenIndexRecoveryTests.java | 6 +- .../index/engine/FrozenIndexShardTests.java | 2 +- .../index/engine/FrozenIndexTests.java | 34 +- .../xpack/graph/test/GraphTests.java | 4 +- .../idp/ManageServiceProviderRestIT.java | 6 +- .../idp/WildcardServiceProviderRestIT.java | 4 +- .../idp/saml/sp/SamlServiceProviderIndex.java | 2 +- .../sp/SamlServiceProviderIndexTests.java | 32 +- .../xpack/ilm/ChangePolicyforIndexIT.java | 6 +- .../ilm/TimeSeriesLifecycleActionsIT.java | 220 ++++---- .../xpack/ilm/ExecuteStepsUpdateTask.java | 22 +- .../xpack/ilm/IndexLifecycle.java | 6 +- .../xpack/ilm/IndexLifecycleFeatureSet.java | 8 +- .../xpack/ilm/IndexLifecycleRunner.java | 138 ++--- .../xpack/ilm/IndexLifecycleService.java | 26 +- .../xpack/ilm/IndexLifecycleTransition.java | 56 +- .../xpack/ilm/MoveToErrorStepUpdateTask.java | 8 +- .../xpack/ilm/MoveToNextStepUpdateTask.java | 10 +- .../xpack/ilm/OperationModeUpdateTask.java | 10 +- .../xpack/ilm/PolicyStepsRegistry.java | 12 +- .../xpack/ilm/SetStepInfoUpdateTask.java | 4 +- .../TransportDeleteLifecycleAction.java | 10 +- .../TransportExplainLifecycleAction.java | 4 +- .../action/TransportGetLifecycleAction.java | 2 +- .../ilm/action/TransportGetStatusAction.java | 2 +- .../ilm/action/TransportMoveToStepAction.java | 16 +- .../action/TransportPutLifecycleAction.java | 24 +- .../ilm/action/TransportRetryAction.java | 4 +- .../xpack/ilm/history/ILMHistoryStore.java | 4 +- .../xpack/slm/SLMFeatureSet.java | 2 +- .../xpack/slm/SnapshotLifecycleService.java | 12 +- .../xpack/slm/SnapshotLifecycleTask.java | 10 +- .../xpack/slm/SnapshotRetentionTask.java | 4 +- .../slm/UpdateSnapshotLifecycleStatsTask.java | 6 +- ...ransportDeleteSnapshotLifecycleAction.java | 8 +- ...ansportExecuteSnapshotLifecycleAction.java | 2 +- .../action/TransportGetSLMStatusAction.java | 2 +- .../TransportGetSnapshotLifecycleAction.java | 2 +- ...nsportGetSnapshotLifecycleStatsAction.java | 2 +- .../TransportPutSnapshotLifecycleAction.java | 8 +- .../ilm/ExecuteStepsUpdateTaskTests.java | 58 +-- .../ilm/IndexLifecycleFeatureSetTests.java | 16 +- .../IndexLifecycleInitialisationTests.java | 12 +- .../ilm/IndexLifecycleMetadataTests.java | 12 +- .../xpack/ilm/IndexLifecycleRunnerTests.java | 198 ++++---- .../xpack/ilm/IndexLifecycleServiceTests.java | 46 +- .../ilm/IndexLifecycleTransitionTests.java | 112 ++-- .../ilm/MoveToErrorStepUpdateTaskTests.java | 22 +- .../ilm/MoveToNextStepUpdateTaskTests.java | 24 +- .../ilm/OperationModeUpdateTaskTests.java | 16 +- .../xpack/ilm/PolicyStepsRegistryTests.java | 68 +-- .../xpack/ilm/SetStepInfoUpdateTaskTests.java | 22 +- .../xpack/ilm/UpdateSettingsStepTests.java | 8 +- .../TransportPutLifecycleActionTests.java | 52 +- .../ilm/history/ILMHistoryStoreTests.java | 44 +- .../SnapshotLifecycleInitialisationTests.java | 2 +- .../slm/SnapshotLifecycleServiceTests.java | 38 +- .../xpack/slm/SnapshotLifecycleTaskTests.java | 10 +- .../xpack/slm/SnapshotRetentionTaskTests.java | 12 +- .../xpack/logstash/Logstash.java | 4 +- .../xpack/flattened/FlattenedFeatureSet.java | 12 +- .../ml/integration/BulkFailureRetryIT.java | 6 +- .../xpack/ml/integration/ForecastIT.java | 8 +- .../ml/integration/MlNativeIntegTestCase.java | 8 +- .../ml/integration/ScheduledEventsIT.java | 4 +- .../ml/integration/SetUpgradeModeIT.java | 8 +- .../ml/transforms/PainlessDomainSplitIT.java | 10 +- .../xpack/ml/MachineLearning.java | 4 +- .../xpack/ml/MachineLearningFeatureSet.java | 6 +- .../xpack/ml/MlAssignmentNotifier.java | 16 +- .../ml/MlConfigMigrationEligibilityCheck.java | 8 +- .../xpack/ml/MlConfigMigrator.java | 40 +- .../xpack/ml/MlDailyMaintenanceService.java | 4 +- .../ml/action/TransportCloseJobAction.java | 48 +- ...ansportDeleteDataFrameAnalyticsAction.java | 4 +- .../action/TransportDeleteDatafeedAction.java | 12 +- .../action/TransportDeleteForecastAction.java | 6 +- .../ml/action/TransportDeleteJobAction.java | 22 +- .../TransportDeleteTrainedModelAction.java | 2 +- ...sportGetDataFrameAnalyticsStatsAction.java | 6 +- .../TransportGetDatafeedsStatsAction.java | 8 +- .../action/TransportGetJobsStatsAction.java | 12 +- .../TransportGetTrainedModelsStatsAction.java | 2 +- .../TransportIsolateDatafeedAction.java | 6 +- .../ml/action/TransportJobTaskAction.java | 6 +- .../ml/action/TransportKillProcessAction.java | 6 +- .../ml/action/TransportOpenJobAction.java | 40 +- .../TransportRevertModelSnapshotAction.java | 4 +- .../action/TransportSetUpgradeModeAction.java | 34 +- ...ransportStartDataFrameAnalyticsAction.java | 36 +- .../action/TransportStartDatafeedAction.java | 34 +- ...TransportStopDataFrameAnalyticsAction.java | 20 +- .../action/TransportStopDatafeedAction.java | 22 +- .../action/TransportUpdateDatafeedAction.java | 4 +- .../xpack/ml/datafeed/DatafeedManager.java | 20 +- .../ml/datafeed/DatafeedNodeSelector.java | 16 +- .../persistence/DatafeedConfigProvider.java | 12 +- .../xpack/ml/dataframe/DestinationIndex.java | 22 +- .../xpack/ml/dataframe/MappingsMerger.java | 26 +- .../inference/ingest/InferenceProcessor.java | 8 +- .../loadingservice/ModelLoadingService.java | 4 +- .../xpack/ml/job/JobManager.java | 10 +- .../xpack/ml/job/JobNodeSelector.java | 28 +- .../job/persistence/CalendarQueryBuilder.java | 4 +- .../ml/job/persistence/JobConfigProvider.java | 18 +- .../job/persistence/JobResultsProvider.java | 16 +- .../autodetect/AutodetectProcessManager.java | 2 +- .../xpack/ml/process/MlMemoryTracker.java | 18 +- .../cat/RestCatDataFrameAnalyticsAction.java | 4 +- .../xpack/ml/rest/cat/RestCatJobsAction.java | 4 +- .../rest/cat/RestCatTrainedModelsAction.java | 4 +- .../inference/RestGetTrainedModelsAction.java | 4 +- .../RestGetTrainedModelsStatsAction.java | 4 +- .../ml/rest/job/RestDeleteForecastAction.java | 4 +- .../ml/rest/job/RestGetJobStatsAction.java | 4 +- .../xpack/ml/rest/job/RestGetJobsAction.java | 4 +- .../MachineLearningLicensingTests.java | 10 +- .../ml/MachineLearningFeatureSetTests.java | 4 +- .../xpack/ml/MlAssignmentNotifierTests.java | 38 +- ...lConfigMigrationEligibilityCheckTests.java | 114 ++--- .../xpack/ml/MlConfigMigratorTests.java | 48 +- .../ml/MlDailyMaintenanceServiceTests.java | 6 +- .../action/TransportCloseJobActionTests.java | 28 +- ...sportGetTrainedModelsStatsActionTests.java | 4 +- .../action/TransportOpenJobActionTests.java | 52 +- ...ortStartDataFrameAnalyticsActionTests.java | 24 +- .../TransportStartDatafeedActionTests.java | 14 +- ...portStopDataFrameAnalyticsActionTests.java | 14 +- .../TransportStopDatafeedActionTests.java | 14 +- .../ml/datafeed/DatafeedManagerTests.java | 60 +-- .../datafeed/DatafeedNodeSelectorTests.java | 70 +-- .../ml/dataframe/DestinationIndexTests.java | 58 +-- .../ml/dataframe/MappingsMergerTests.java | 72 +-- .../InferenceProcessorFactoryTests.java | 16 +- .../ModelLoadingServiceTests.java | 6 +- .../ml/integration/AnnotationIndexIT.java | 10 +- .../integration/BasicDistributedJobsIT.java | 16 +- .../integration/DatafeedConfigProviderIT.java | 8 +- .../ml/integration/JobConfigProviderIT.java | 8 +- .../ml/integration/JobResultsProviderIT.java | 22 +- .../integration/JobStorageDeletionTaskIT.java | 6 +- .../ml/integration/MlConfigMigratorIT.java | 52 +- .../integration/MlDistributedFailureIT.java | 14 +- .../xpack/ml/integration/TooManyJobsIT.java | 10 +- .../xpack/ml/job/JobManagerTests.java | 62 +-- .../xpack/ml/job/JobNodeSelectorTests.java | 146 +++--- .../persistence/JobResultsProviderTests.java | 30 +- .../AutodetectProcessManagerTests.java | 24 +- .../ml/process/MlMemoryTrackerTests.java | 34 +- .../xpack/ml/support/BaseMlIntegTestCase.java | 10 +- .../action/TransportMonitoringBulkAction.java | 2 +- .../xpack/monitoring/collector/Collector.java | 2 +- .../cluster/ClusterStatsMonitoringDoc.java | 8 +- .../indices/IndexStatsCollector.java | 4 +- .../indices/IndexStatsMonitoringDoc.java | 26 +- .../collector/ml/JobStatsCollector.java | 4 +- .../exporter/ClusterAlertsUtil.java | 6 +- .../xpack/monitoring/exporter/Exporters.java | 2 +- .../exporter/http/TemplateHttpResource.java | 4 +- .../exporter/local/LocalExporter.java | 12 +- .../monitoring/BaseCollectorTestCase.java | 10 +- .../TransportMonitoringBulkActionTests.java | 4 +- .../local/LocalIndicesCleanerTests.java | 4 +- .../cluster/ClusterStatsCollectorTests.java | 4 +- .../ClusterStatsMonitoringDocTests.java | 4 +- .../indices/IndexRecoveryCollectorTests.java | 4 +- .../indices/IndexStatsCollectorTests.java | 20 +- .../indices/IndexStatsMonitoringDocTests.java | 40 +- .../collector/ml/JobStatsCollectorTests.java | 8 +- .../node/NodeStatsCollectorTests.java | 4 +- .../shards/ShardsCollectorTests.java | 4 +- .../exporter/ClusterAlertsUtilTests.java | 8 +- .../monitoring/exporter/ExportersTests.java | 6 +- .../exporter/http/HttpExporterIT.java | 4 +- .../http/HttpExporterResourceTests.java | 8 +- .../exporter/http/HttpExporterTests.java | 6 +- .../local/LocalExporterIntegTests.java | 6 +- .../LocalExporterResourceIntegTests.java | 4 +- .../test/MonitoringIntegTestCase.java | 4 +- .../xpack/ql/index/IndexResolver.java | 70 +-- .../xpack/rollup/RollupRequestTranslator.java | 4 +- .../rollup/RollupResponseTranslator.java | 2 +- .../xpack/rollup/action/RollupIndexCaps.java | 4 +- .../TransportDeleteRollupJobAction.java | 4 +- .../action/TransportGetRollupCapsAction.java | 22 +- .../TransportGetRollupIndexCapsAction.java | 6 +- .../action/TransportGetRollupJobAction.java | 10 +- .../action/TransportPutRollupJobAction.java | 8 +- .../action/TransportRollupSearchAction.java | 12 +- .../xpack/rollup/job/RollupIndexer.java | 2 +- .../xpack/rollup/job/RollupJobTask.java | 4 +- .../RollupResponseTranslationTests.java | 12 +- .../action/GetJobsActionRequestTests.java | 48 +- .../GetRollupCapsActionRequestTests.java | 82 +-- .../GetRollupIndexCapsActionRequestTests.java | 42 +- .../action/PutJobStateMachineTests.java | 42 +- .../rollup/action/RollupIndexCapsTests.java | 4 +- .../rollup/action/SearchActionTests.java | 72 +-- .../rollup/job/RollupIndexerStateTests.java | 10 +- .../xpack/rollup/job/RollupJobTaskTests.java | 50 +- .../xpack/security/Security.java | 16 +- .../TransportOpenIdConnectLogoutAction.java | 2 +- .../saml/TransportSamlLogoutAction.java | 2 +- .../xpack/security/authc/TokenService.java | 76 +-- .../ldap/ActiveDirectorySessionFactory.java | 34 +- .../xpack/security/authc/ldap/LdapRealm.java | 2 +- .../authc/ldap/LdapSessionFactory.java | 2 +- .../ldap/LdapUserSearchSessionFactory.java | 10 +- ...esolver.java => LdapMetadataResolver.java} | 10 +- .../authc/ldap/support/LdapSession.java | 18 +- .../authc/ldap/support/SessionFactory.java | 4 +- .../security/authz/AuthorizationService.java | 28 +- .../authz/IndicesAndAliasesResolver.java | 78 +-- .../DeprecationRoleDescriptorConsumer.java | 6 +- .../support/SecurityIndexManager.java | 74 +-- .../DocumentAndFieldLevelSecurityTests.java | 32 +- .../integration/KibanaUserRoleIntegTests.java | 28 +- .../PermissionPrecedenceTests.java | 4 +- .../test/SecurityIntegTestCase.java | 8 +- .../xpack/security/SecurityTests.java | 30 +- .../xpack/security/TemplateUpgraderTests.java | 10 +- .../saml/TransportSamlLogoutActionTests.java | 10 +- .../action/user/PutUserRequestTests.java | 2 +- .../authc/AuthenticationServiceTests.java | 4 +- .../authc/SecurityRealmSettingsTests.java | 2 +- .../security/authc/TokenAuthIntegTests.java | 4 +- .../security/authc/TokenServiceTests.java | 26 +- .../authc/esnative/NativeRealmTests.java | 4 +- .../authc/ldap/ActiveDirectoryRealmTests.java | 6 +- .../security/authc/ldap/LdapRealmTests.java | 6 +- ...ts.java => LdapMetadataResolverTests.java} | 16 +- .../authc/saml/SamlRealmTestHelper.java | 2 +- .../security/authc/saml/SamlRealmTests.java | 8 +- .../mapper/NativeRoleMappingStoreTests.java | 4 +- .../authz/AuthorizationServiceTests.java | 100 ++-- .../authz/AuthorizedIndicesTests.java | 62 +-- .../authz/IndicesAndAliasesResolverTests.java | 100 ++-- ...ldDataCacheWithFieldSubsetReaderTests.java | 8 +- .../accesscontrol/IndicesPermissionTests.java | 64 +-- .../accesscontrol/OptOutQueryCacheTests.java | 18 +- .../authz/store/CompositeRolesStoreTests.java | 12 +- ...eprecationRoleDescriptorConsumerTests.java | 118 ++--- .../authz/store/NativeRolesStoreTests.java | 22 +- .../support/SecurityIndexManagerTests.java | 112 ++-- .../security/test/SecurityTestUtils.java | 18 +- .../filter/IpFilteringUpdateTests.java | 24 +- .../xpack/sql/type/SqlDataTypesTests.java | 6 +- .../xpack/test/rest/XPackRestIT.java | 4 +- .../test/ml/ml_classic_analyze.yml | 4 +- .../integration/TransformAuditorIT.java | 6 +- ...taDataIT.java => TransformMetadataIT.java} | 4 +- .../xpack/transform/Transform.java | 8 +- .../TransformClusterStateListener.java | 6 +- .../xpack/transform/TransformFeatureSet.java | 8 +- .../transform/action/TransformNodes.java | 14 +- .../TransportDeleteTransformAction.java | 4 +- .../TransportGetTransformStatsAction.java | 8 +- .../action/TransportPutTransformAction.java | 4 +- .../action/TransportStartTransformAction.java | 32 +- .../action/TransportStopTransformAction.java | 30 +- .../TransportUpdateTransformAction.java | 4 +- .../transform/persistence/TransformIndex.java | 26 +- .../persistence/TransformInternalIndex.java | 52 +- .../rest/action/RestCatTransformAction.java | 4 +- .../TransformPersistentTasksExecutor.java | 14 +- .../transform/transforms/TransformTask.java | 4 +- .../transform/action/TransformNodesTests.java | 14 +- .../TransportStopTransformActionTests.java | 30 +- .../TransformInternalIndexTests.java | 18 +- ...TransformPersistentTasksExecutorTests.java | 64 +-- .../xpack/vectors/VectorsFeatureSet.java | 12 +- .../xpack/vectors/VectorsFeatureSetTests.java | 16 +- .../mapper/DenseVectorFieldMapperTests.java | 4 +- .../mapper/SparseVectorFieldMapperTests.java | 4 +- .../coordination/VotingOnlyNodePlugin.java | 2 +- .../elasticsearch/xpack/watcher/Watcher.java | 4 +- .../watcher/WatcherIndexingListener.java | 14 +- .../watcher/WatcherLifeCycleService.java | 14 +- .../xpack/watcher/WatcherService.java | 28 +- .../execution/TriggeredWatchStore.java | 12 +- .../xpack/watcher/history/HistoryStore.java | 8 +- .../support/WatcherIndexTemplateRegistry.java | 16 +- .../TransportWatcherServiceAction.java | 20 +- .../stats/TransportWatcherStatsAction.java | 14 +- .../xpack/watcher/watch/WatchStoreUtils.java | 12 +- .../xpack/watcher/WatcherFeatureSetTests.java | 4 +- .../watcher/WatcherIndexingListenerTests.java | 74 +-- .../watcher/WatcherLifeCycleServiceTests.java | 152 +++--- ...=> WatcherMetadataSerializationTests.java} | 56 +- .../xpack/watcher/WatcherServiceTests.java | 28 +- .../condition/ScriptConditionTests.java | 6 +- .../execution/TriggeredWatchStoreTests.java | 72 +-- .../HistoryTemplateHttpMappingsTests.java | 6 +- .../HistoryTemplateTimeMappingsTests.java | 6 +- ...HistoryTemplateTransformMappingsTests.java | 2 +- .../WatcherIndexTemplateRegistryTests.java | 16 +- .../AbstractWatcherIntegrationTestCase.java | 4 +- .../test/integration/BootStrapTests.java | 6 +- .../test/integration/SingleNodeTests.java | 6 +- .../ack/TransportAckWatchActionTests.java | 6 +- .../TransportWatcherStatsActionTests.java | 4 +- .../mapper/WildcardFieldMapperTests.java | 90 ++-- .../org/elasticsearch/test/OpenLdapTests.java | 18 +- .../UpgradeClusterClientYamlTestSuiteIT.java | 2 +- .../snapshots/S3CleanupTests.java | 4 +- .../snapshots/AbstractCleanupTests.java | 4 +- .../test/feature_aware/FeatureAwareCheck.java | 4 +- .../feature_aware/FeatureAwareCheckTests.java | 36 +- 1773 files changed, 19223 insertions(+), 19223 deletions(-) rename client/rest-high-level/src/main/java/org/elasticsearch/client/indices/{IndexTemplateMetaData.java => IndexTemplateMetadata.java} (76%) rename client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/{WatcherMetaData.java => WatcherMetadata.java} (91%) rename server/src/main/java/org/elasticsearch/action/admin/indices/rollover/{MetaDataRolloverService.java => MetadataRolloverService.java} (80%) rename server/src/main/java/org/elasticsearch/cluster/{MergableCustomMetaData.java => MergableCustomMetadata.java} (88%) rename server/src/main/java/org/elasticsearch/cluster/coordination/{CoordinationMetaData.java => CoordinationMetadata.java} (94%) rename server/src/main/java/org/elasticsearch/cluster/metadata/{AliasMetaData.java => AliasMetadata.java} (86%) rename server/src/main/java/org/elasticsearch/cluster/metadata/{IndexMetaData.java => IndexMetadata.java} (90%) rename server/src/main/java/org/elasticsearch/cluster/metadata/{IndexTemplateMetaData.java => IndexTemplateMetadata.java} (85%) rename server/src/main/java/org/elasticsearch/cluster/metadata/{MappingMetaData.java => MappingMetadata.java} (93%) rename server/src/main/java/org/elasticsearch/cluster/metadata/{MetaData.java => Metadata.java} (82%) rename server/src/main/java/org/elasticsearch/cluster/metadata/{MetaDataCreateIndexService.java => MetadataCreateIndexService.java} (84%) rename server/src/main/java/org/elasticsearch/cluster/metadata/{MetaDataDeleteIndexService.java => MetadataDeleteIndexService.java} (92%) rename server/src/main/java/org/elasticsearch/cluster/metadata/{MetaDataIndexAliasesService.java => MetadataIndexAliasesService.java} (87%) rename server/src/main/java/org/elasticsearch/cluster/metadata/{MetaDataIndexStateService.java => MetadataIndexStateService.java} (91%) rename server/src/main/java/org/elasticsearch/cluster/metadata/{MetaDataIndexTemplateService.java => MetadataIndexTemplateService.java} (89%) rename server/src/main/java/org/elasticsearch/cluster/metadata/{MetaDataIndexUpgradeService.java => MetadataIndexUpgradeService.java} (81%) rename server/src/main/java/org/elasticsearch/cluster/metadata/{MetaDataMappingService.java => MetadataMappingService.java} (90%) rename server/src/main/java/org/elasticsearch/cluster/metadata/{MetaDataUpdateSettingsService.java => MetadataUpdateSettingsService.java} (80%) rename server/src/main/java/org/elasticsearch/cluster/metadata/{RepositoriesMetaData.java => RepositoriesMetadata.java} (85%) rename server/src/main/java/org/elasticsearch/cluster/metadata/{RepositoryMetaData.java => RepositoryMetadata.java} (91%) rename server/src/main/java/org/elasticsearch/cluster/routing/allocation/{IndexMetaDataUpdater.java => IndexMetadataUpdater.java} (82%) rename server/src/main/java/org/elasticsearch/common/blobstore/{BlobMetaData.java => BlobMetadata.java} (97%) rename server/src/main/java/org/elasticsearch/common/blobstore/support/{PlainBlobMetaData.java => PlainBlobMetadata.java} (87%) rename server/src/main/java/org/elasticsearch/env/{NodeMetaData.java => NodeMetadata.java} (83%) rename server/src/main/java/org/elasticsearch/gateway/{MetaDataStateFormat.java => MetadataStateFormat.java} (98%) rename server/src/main/java/org/elasticsearch/index/shard/{ShardStateMetaData.java => ShardStateMetadata.java} (84%) rename server/src/main/java/org/elasticsearch/index/store/{StoreFileMetaData.java => StoreFileMetadata.java} (94%) rename server/src/main/java/org/elasticsearch/indices/store/{TransportNodesListShardStoreMetaData.java => TransportNodesListShardStoreMetadata.java} (80%) rename server/src/main/java/org/elasticsearch/persistent/{PersistentTasksCustomMetaData.java => PersistentTasksCustomMetadata.java} (93%) rename server/src/main/java/org/elasticsearch/plugins/{MetaDataUpgrader.java => MetadataUpgrader.java} (62%) rename server/src/main/java/org/elasticsearch/script/{ScriptMetaData.java => ScriptMetadata.java} (87%) rename server/src/test/java/org/elasticsearch/action/admin/indices/rollover/{MetaDataRolloverServiceTests.java => MetadataRolloverServiceTests.java} (77%) rename server/src/test/java/org/elasticsearch/cluster/coordination/{CoordinationMetaDataTests.java => CoordinationMetadataTests.java} (92%) rename server/src/test/java/org/elasticsearch/cluster/metadata/{AliasMetaDataTests.java => AliasMetadataTests.java} (83%) rename server/src/test/java/org/elasticsearch/cluster/metadata/{IndexMetaDataTests.java => IndexMetadataTests.java} (69%) rename server/src/test/java/org/elasticsearch/cluster/metadata/{IndexTemplateMetaDataTests.java => IndexTemplateMetadataTests.java} (86%) rename server/src/test/java/org/elasticsearch/cluster/metadata/{MetaDataCreateIndexServiceTests.java => MetadataCreateIndexServiceTests.java} (86%) rename server/src/test/java/org/elasticsearch/cluster/metadata/{MetaDataDeleteIndexServiceTests.java => MetadataDeleteIndexServiceTests.java} (91%) rename server/src/test/java/org/elasticsearch/cluster/metadata/{MetaDataIndexAliasesServiceTests.java => MetadataIndexAliasesServiceTests.java} (81%) rename server/src/test/java/org/elasticsearch/cluster/metadata/{MetaDataIndexStateServiceTests.java => MetadataIndexStateServiceTests.java} (81%) rename server/src/test/java/org/elasticsearch/cluster/metadata/{MetaDataIndexStateServiceUtils.java => MetadataIndexStateServiceUtils.java} (83%) rename server/src/test/java/org/elasticsearch/cluster/metadata/{MetaDataIndexTemplateServiceTests.java => MetadataIndexTemplateServiceTests.java} (75%) rename server/src/test/java/org/elasticsearch/cluster/metadata/{MetaDataIndexUpgradeServiceTests.java => MetadataIndexUpgradeServiceTests.java} (63%) rename server/src/test/java/org/elasticsearch/cluster/metadata/{MetaDataMappingServiceTests.java => MetadataMappingServiceTests.java} (89%) rename server/src/test/java/org/elasticsearch/cluster/metadata/{MetaDataTests.java => MetadataTests.java} (70%) rename server/src/test/java/org/elasticsearch/cluster/metadata/{ToAndFromJsonMetaDataTests.java => ToAndFromJsonMetadataTests.java} (81%) rename server/src/test/java/org/elasticsearch/env/{NodeMetaDataTests.java => NodeMetadataTests.java} (73%) rename server/src/test/java/org/elasticsearch/gateway/{MetaDataStateFormatTests.java => MetadataStateFormatTests.java} (96%) rename server/src/test/java/org/elasticsearch/gateway/{MetaDataWriteDataNodesIT.java => MetadataWriteDataNodesIT.java} (88%) rename server/src/test/java/org/elasticsearch/persistent/{PersistentTasksCustomMetaDataTests.java => PersistentTasksCustomMetadataTests.java} (82%) rename server/src/test/java/org/elasticsearch/script/{ScriptMetaDataTests.java => ScriptMetadataTests.java} (85%) rename server/src/test/java/org/elasticsearch/search/aggregations/{MetaDataIT.java => MetadataIT.java} (79%) rename server/src/test/java/org/elasticsearch/snapshots/{RepositoriesMetaDataSerializationTests.java => RepositoriesMetadataSerializationTests.java} (71%) rename test/framework/src/main/java/org/elasticsearch/test/{TestCustomMetaData.java => TestCustomMetadata.java} (85%) rename x-pack/plugin/core/src/main/java/org/elasticsearch/license/{LicensesMetaData.java => LicensesMetadata.java} (85%) rename x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/{TokenMetaData.java => TokenMetadata.java} (90%) rename x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/ldap/support/{LdapMetaDataResolverSettings.java => LdapMetadataResolverSettings.java} (90%) rename x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/{WatcherMetaData.java => WatcherMetadata.java} (80%) rename x-pack/plugin/core/src/test/java/org/elasticsearch/license/{LicensesMetaDataSerializationTests.java => LicensesMetadataSerializationTests.java} (61%) rename x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authc/{TokenMetaDataTests.java => TokenMetadataTests.java} (79%) rename x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ldap/support/{LdapMetaDataResolver.java => LdapMetadataResolver.java} (93%) rename x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/ldap/support/{LdapMetaDataResolverTests.java => LdapMetadataResolverTests.java} (90%) rename x-pack/plugin/transform/qa/single-node-tests/src/test/java/org/elasticsearch/xpack/transform/integration/{TransformMetaDataIT.java => TransformMetadataIT.java} (95%) rename x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/{WatcherMetaDataSerializationTests.java => WatcherMetadataSerializationTests.java} (57%) diff --git a/benchmarks/src/main/java/org/elasticsearch/benchmark/routing/allocation/AllocationBenchmark.java b/benchmarks/src/main/java/org/elasticsearch/benchmark/routing/allocation/AllocationBenchmark.java index 91573e5a406..ed34209a777 100644 --- a/benchmarks/src/main/java/org/elasticsearch/benchmark/routing/allocation/AllocationBenchmark.java +++ b/benchmarks/src/main/java/org/elasticsearch/benchmark/routing/allocation/AllocationBenchmark.java @@ -21,8 +21,8 @@ package org.elasticsearch.benchmark.routing.allocation; import org.elasticsearch.Version; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.ShardRoutingState; @@ -127,19 +127,19 @@ public class AllocationBenchmark { Settings.builder().put("cluster.routing.allocation.awareness.attributes", "tag").build() ); - MetaData.Builder mb = MetaData.builder(); + Metadata.Builder mb = Metadata.builder(); for (int i = 1; i <= numIndices; i++) { mb.put( - IndexMetaData.builder("test_" + i) + IndexMetadata.builder("test_" + i) .settings(Settings.builder().put("index.version.created", Version.CURRENT)) .numberOfShards(numShards) .numberOfReplicas(numReplicas) ); } - MetaData metaData = mb.build(); + Metadata metadata = mb.build(); RoutingTable.Builder rb = RoutingTable.builder(); for (int i = 1; i <= numIndices; i++) { - rb.addAsNew(metaData.index("test_" + i)); + rb.addAsNew(metadata.index("test_" + i)); } RoutingTable routingTable = rb.build(); DiscoveryNodes.Builder nb = DiscoveryNodes.builder(); @@ -147,7 +147,7 @@ public class AllocationBenchmark { nb.add(Allocators.newNode("node" + i, Collections.singletonMap("tag", "tag_" + (i % numTags)))); } initialClusterState = ClusterState.builder(ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY)) - .metaData(metaData) + .metadata(metadata) .routingTable(routingTable) .nodes(nb) .build(); diff --git a/client/benchmark/src/main/java/org/elasticsearch/client/benchmark/rest/RestClientBenchmark.java b/client/benchmark/src/main/java/org/elasticsearch/client/benchmark/rest/RestClientBenchmark.java index d32c37dc2c4..653cda50b7e 100644 --- a/client/benchmark/src/main/java/org/elasticsearch/client/benchmark/rest/RestClientBenchmark.java +++ b/client/benchmark/src/main/java/org/elasticsearch/client/benchmark/rest/RestClientBenchmark.java @@ -63,18 +63,18 @@ public final class RestClientBenchmark extends AbstractBenchmark { private static final class RestBulkRequestExecutor implements BulkRequestExecutor { private final RestClient client; - private final String actionMetaData; + private final String actionMetadata; RestBulkRequestExecutor(RestClient client, String index, String type) { this.client = client; - this.actionMetaData = String.format(Locale.ROOT, "{ \"index\" : { \"_index\" : \"%s\", \"_type\" : \"%s\" } }%n", index, type); + this.actionMetadata = String.format(Locale.ROOT, "{ \"index\" : { \"_index\" : \"%s\", \"_type\" : \"%s\" } }%n", index, type); } @Override public boolean bulkIndex(List bulkData) { StringBuilder bulkRequestBody = new StringBuilder(); for (String bulkItem : bulkData) { - bulkRequestBody.append(actionMetaData); + bulkRequestBody.append(actionMetadata); bulkRequestBody.append(bulkItem); bulkRequestBody.append("\n"); } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/GetAliasesResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/GetAliasesResponse.java index 12791884d1a..2f27b6e69e9 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/GetAliasesResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/GetAliasesResponse.java @@ -20,7 +20,7 @@ package org.elasticsearch.client; import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.cluster.metadata.AliasMetaData; +import org.elasticsearch.cluster.metadata.AliasMetadata; import org.elasticsearch.common.xcontent.StatusToXContentObject; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -52,9 +52,9 @@ public class GetAliasesResponse implements StatusToXContentObject { private final String error; private final ElasticsearchException exception; - private final Map> aliases; + private final Map> aliases; - GetAliasesResponse(RestStatus status, String error, Map> aliases) { + GetAliasesResponse(RestStatus status, String error, Map> aliases) { this.status = status; this.error = error; this.aliases = aliases; @@ -90,7 +90,7 @@ public class GetAliasesResponse implements StatusToXContentObject { /** * Return the requested aliases */ - public Map> getAliases() { + public Map> getAliases() { return aliases; } @@ -103,13 +103,13 @@ public class GetAliasesResponse implements StatusToXContentObject { builder.field("status", status.getStatus()); } - for (Map.Entry> entry : aliases.entrySet()) { + for (Map.Entry> entry : aliases.entrySet()) { builder.startObject(entry.getKey()); { builder.startObject("aliases"); { - for (final AliasMetaData alias : entry.getValue()) { - AliasMetaData.Builder.toXContent(alias, builder, ToXContent.EMPTY_PARAMS); + for (final AliasMetadata alias : entry.getValue()) { + AliasMetadata.Builder.toXContent(alias, builder, ToXContent.EMPTY_PARAMS); } } builder.endObject(); @@ -129,7 +129,7 @@ public class GetAliasesResponse implements StatusToXContentObject { parser.nextToken(); } ensureExpectedToken(Token.START_OBJECT, parser.currentToken(), parser::getTokenLocation); - Map> aliases = new HashMap<>(); + Map> aliases = new HashMap<>(); String currentFieldName; Token token; @@ -159,7 +159,7 @@ public class GetAliasesResponse implements StatusToXContentObject { } else { String indexName = parser.currentName(); if (parser.nextToken() == Token.START_OBJECT) { - Set parseInside = parseAliases(parser); + Set parseInside = parseAliases(parser); aliases.put(indexName, parseInside); } } @@ -173,8 +173,8 @@ public class GetAliasesResponse implements StatusToXContentObject { return new GetAliasesResponse(status, error, aliases); } - private static Set parseAliases(XContentParser parser) throws IOException { - Set aliases = new HashSet<>(); + private static Set parseAliases(XContentParser parser) throws IOException { + Set aliases = new HashSet<>(); Token token; String currentFieldName = null; while ((token = parser.nextToken()) != Token.END_OBJECT) { @@ -183,7 +183,7 @@ public class GetAliasesResponse implements StatusToXContentObject { } else if (token == Token.START_OBJECT) { if ("aliases".equals(currentFieldName)) { while (parser.nextToken() != Token.END_OBJECT) { - AliasMetaData fromXContent = AliasMetaData.Builder.fromXContent(parser); + AliasMetadata fromXContent = AliasMetadata.Builder.fromXContent(parser); aliases.add(fromXContent); } } else { diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesRequestConverters.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesRequestConverters.java index 55bd4b98780..4e6c5b5b1f0 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesRequestConverters.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesRequestConverters.java @@ -54,7 +54,7 @@ import org.elasticsearch.client.indices.ReloadAnalyzersRequest; import org.elasticsearch.client.indices.ResizeRequest; import org.elasticsearch.client.indices.UnfreezeIndexRequest; import org.elasticsearch.client.indices.rollover.RolloverRequest; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Strings; import java.io.IOException; @@ -326,7 +326,7 @@ final class IndicesRequestConverters { } static Request split(ResizeRequest resizeRequest) throws IOException { - if (IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.exists(resizeRequest.getSettings()) == false) { + if (IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.exists(resizeRequest.getSettings()) == false) { throw new IllegalArgumentException("index.number_of_shards is required for split operations"); } return resize(resizeRequest, ResizeType.SPLIT); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/StringStatsAggregationBuilder.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/StringStatsAggregationBuilder.java index cc7dbc1bd0b..0122ebaf37c 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/StringStatsAggregationBuilder.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/StringStatsAggregationBuilder.java @@ -98,7 +98,7 @@ public class StringStatsAggregationBuilder extends ValuesSourceAggregationBuilde } @Override - protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map metaData) { + protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map metadata) { throw new UnsupportedOperationException(); } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/TopMetricsAggregationBuilder.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/TopMetricsAggregationBuilder.java index d520aa2794b..34c8f3e1db2 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/TopMetricsAggregationBuilder.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/TopMetricsAggregationBuilder.java @@ -106,7 +106,7 @@ public class TopMetricsAggregationBuilder extends AbstractAggregationBuilder metaData) { + protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map metadata) { throw new UnsupportedOperationException(); } } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetFieldMappingsResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetFieldMappingsResponse.java index b982eab2354..b2722267e6b 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetFieldMappingsResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetFieldMappingsResponse.java @@ -43,7 +43,7 @@ public class GetFieldMappingsResponse { private static final ParseField MAPPINGS = new ParseField("mappings"); - private static final ObjectParser, String> PARSER = + private static final ObjectParser, String> PARSER = new ObjectParser<>(MAPPINGS.getPreferredName(), true, HashMap::new); static { @@ -51,16 +51,16 @@ public class GetFieldMappingsResponse { p.nextToken(); while (p.currentToken() == XContentParser.Token.FIELD_NAME) { final String fieldName = p.currentName(); - final FieldMappingMetaData fieldMappingMetaData = FieldMappingMetaData.fromXContent(p); - fieldMappings.put(fieldName, fieldMappingMetaData); + final FieldMappingMetadata fieldMappingMetadata = FieldMappingMetadata.fromXContent(p); + fieldMappings.put(fieldName, fieldMappingMetadata); p.nextToken(); } }, MAPPINGS, ObjectParser.ValueType.OBJECT); } - private Map> mappings; + private Map> mappings; - GetFieldMappingsResponse(Map> mappings) { + GetFieldMappingsResponse(Map> mappings) { this.mappings = mappings; } @@ -68,7 +68,7 @@ public class GetFieldMappingsResponse { /** * Returns the fields mapping. The return map keys are indexes and fields (as specified in the request). */ - public Map> mappings() { + public Map> mappings() { return mappings; } @@ -76,10 +76,10 @@ public class GetFieldMappingsResponse { * Returns the mappings of a specific index and field. * * @param field field name as specified in the {@link GetFieldMappingsRequest} - * @return FieldMappingMetaData for the requested field or null if not found. + * @return FieldMappingMetadata for the requested field or null if not found. */ - public FieldMappingMetaData fieldMappings(String index, String field) { - Map indexMapping = mappings.get(index); + public FieldMappingMetadata fieldMappings(String index, String field) { + Map indexMapping = mappings.get(index); if (indexMapping == null) { return null; } @@ -89,11 +89,11 @@ public class GetFieldMappingsResponse { public static GetFieldMappingsResponse fromXContent(XContentParser parser) throws IOException { ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.nextToken(), parser::getTokenLocation); - final Map> mappings = new HashMap<>(); + final Map> mappings = new HashMap<>(); if (parser.nextToken() == XContentParser.Token.FIELD_NAME) { while (parser.currentToken() == XContentParser.Token.FIELD_NAME) { final String index = parser.currentName(); - final Map fieldMappings = PARSER.parse(parser, index); + final Map fieldMappings = PARSER.parse(parser, index); mappings.put(index, fieldMappings); parser.nextToken(); } @@ -101,13 +101,13 @@ public class GetFieldMappingsResponse { return new GetFieldMappingsResponse(mappings); } - public static class FieldMappingMetaData { + public static class FieldMappingMetadata { private static final ParseField FULL_NAME = new ParseField("full_name"); private static final ParseField MAPPING = new ParseField("mapping"); - private static final ConstructingObjectParser PARSER = + private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>("field_mapping_meta_data", true, - a -> new FieldMappingMetaData((String)a[0], (BytesReference)a[1]) + a -> new FieldMappingMetadata((String)a[0], (BytesReference)a[1]) ); static { @@ -124,7 +124,7 @@ public class GetFieldMappingsResponse { private String fullName; private BytesReference source; - public FieldMappingMetaData(String fullName, BytesReference source) { + public FieldMappingMetadata(String fullName, BytesReference source) { this.fullName = fullName; this.source = source; } @@ -145,20 +145,20 @@ public class GetFieldMappingsResponse { return source; } - public static FieldMappingMetaData fromXContent(XContentParser parser) throws IOException { + public static FieldMappingMetadata fromXContent(XContentParser parser) throws IOException { return PARSER.parse(parser, null); } @Override public String toString() { - return "FieldMappingMetaData{fullName='" + fullName + '\'' + ", source=" + source + '}'; + return "FieldMappingMetadata{fullName='" + fullName + '\'' + ", source=" + source + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof FieldMappingMetaData)) return false; - FieldMappingMetaData that = (FieldMappingMetaData) o; + if (!(o instanceof FieldMappingMetadata)) return false; + FieldMappingMetadata that = (FieldMappingMetadata) o; return Objects.equals(fullName, that.fullName) && Objects.equals(source, that.source); } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetIndexResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetIndexResponse.java index 3d98f93df47..5eb3155374c 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetIndexResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetIndexResponse.java @@ -20,8 +20,8 @@ package org.elasticsearch.client.indices; import org.apache.lucene.util.CollectionUtil; -import org.elasticsearch.cluster.metadata.AliasMetaData; -import org.elasticsearch.cluster.metadata.MappingMetaData; +import org.elasticsearch.cluster.metadata.AliasMetadata; +import org.elasticsearch.cluster.metadata.MappingMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentParser.Token; @@ -43,15 +43,15 @@ import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpect */ public class GetIndexResponse { - private Map mappings; - private Map> aliases; + private Map mappings; + private Map> aliases; private Map settings; private Map defaultSettings; private String[] indices; GetIndexResponse(String[] indices, - Map mappings, - Map> aliases, + Map mappings, + Map> aliases, Map settings, Map defaultSettings) { this.indices = indices; @@ -75,11 +75,11 @@ public class GetIndexResponse { return indices; } - public Map getMappings() { + public Map getMappings() { return mappings; } - public Map> getAliases() { + public Map> getAliases() { return aliases; } @@ -123,23 +123,23 @@ public class GetIndexResponse { } } - private static List parseAliases(XContentParser parser) throws IOException { - List indexAliases = new ArrayList<>(); + private static List parseAliases(XContentParser parser) throws IOException { + List indexAliases = new ArrayList<>(); // We start at START_OBJECT since parseIndexEntry ensures that while (parser.nextToken() != Token.END_OBJECT) { ensureExpectedToken(Token.FIELD_NAME, parser.currentToken(), parser::getTokenLocation); - indexAliases.add(AliasMetaData.Builder.fromXContent(parser)); + indexAliases.add(AliasMetadata.Builder.fromXContent(parser)); } return indexAliases; } - private static MappingMetaData parseMappings(XContentParser parser) throws IOException { - return new MappingMetaData(MapperService.SINGLE_MAPPING_NAME, parser.map()); + private static MappingMetadata parseMappings(XContentParser parser) throws IOException { + return new MappingMetadata(MapperService.SINGLE_MAPPING_NAME, parser.map()); } private static IndexEntry parseIndexEntry(XContentParser parser) throws IOException { - List indexAliases = null; - MappingMetaData indexMappings = null; + List indexAliases = null; + MappingMetadata indexMappings = null; Settings indexSettings = null; Settings indexDefaultSettings = null; // We start at START_OBJECT since fromXContent ensures that @@ -172,11 +172,11 @@ public class GetIndexResponse { // This is just an internal container to make stuff easier for returning private static class IndexEntry { - List indexAliases = new ArrayList<>(); - MappingMetaData indexMappings; + List indexAliases = new ArrayList<>(); + MappingMetadata indexMappings; Settings indexSettings = Settings.EMPTY; Settings indexDefaultSettings = Settings.EMPTY; - IndexEntry(List indexAliases, MappingMetaData indexMappings, Settings indexSettings, Settings indexDefaultSettings) { + IndexEntry(List indexAliases, MappingMetadata indexMappings, Settings indexSettings, Settings indexDefaultSettings) { if (indexAliases != null) this.indexAliases = indexAliases; if (indexMappings != null) this.indexMappings = indexMappings; if (indexSettings != null) this.indexSettings = indexSettings; @@ -185,8 +185,8 @@ public class GetIndexResponse { } public static GetIndexResponse fromXContent(XContentParser parser) throws IOException { - Map> aliases = new HashMap<>(); - Map mappings = new HashMap<>(); + Map> aliases = new HashMap<>(); + Map mappings = new HashMap<>(); Map settings = new HashMap<>(); Map defaultSettings = new HashMap<>(); List indices = new ArrayList<>(); @@ -204,7 +204,7 @@ public class GetIndexResponse { indices.add(indexName); IndexEntry indexEntry = parseIndexEntry(parser); // make the order deterministic - CollectionUtil.timSort(indexEntry.indexAliases, Comparator.comparing(AliasMetaData::alias)); + CollectionUtil.timSort(indexEntry.indexAliases, Comparator.comparing(AliasMetadata::alias)); aliases.put(indexName, Collections.unmodifiableList(indexEntry.indexAliases)); mappings.put(indexName, indexEntry.indexMappings); settings.put(indexName, indexEntry.indexSettings); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetIndexTemplatesResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetIndexTemplatesResponse.java index ef283b31c06..cac8c6974a0 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetIndexTemplatesResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetIndexTemplatesResponse.java @@ -31,32 +31,32 @@ public class GetIndexTemplatesResponse { @Override public String toString() { - List thisList = new ArrayList<>(this.indexTemplates); - thisList.sort(Comparator.comparing(IndexTemplateMetaData::name)); + List thisList = new ArrayList<>(this.indexTemplates); + thisList.sort(Comparator.comparing(IndexTemplateMetadata::name)); return "GetIndexTemplatesResponse [indexTemplates=" + thisList + "]"; } - private final List indexTemplates; + private final List indexTemplates; GetIndexTemplatesResponse() { indexTemplates = new ArrayList<>(); } - GetIndexTemplatesResponse(List indexTemplates) { + GetIndexTemplatesResponse(List indexTemplates) { this.indexTemplates = indexTemplates; } - public List getIndexTemplates() { + public List getIndexTemplates() { return indexTemplates; } public static GetIndexTemplatesResponse fromXContent(XContentParser parser) throws IOException { - final List templates = new ArrayList<>(); + final List templates = new ArrayList<>(); for (XContentParser.Token token = parser.nextToken(); token != XContentParser.Token.END_OBJECT; token = parser.nextToken()) { if (token == XContentParser.Token.FIELD_NAME) { - final IndexTemplateMetaData templateMetaData = IndexTemplateMetaData.Builder.fromXContent(parser, parser.currentName()); - templates.add(templateMetaData); + final IndexTemplateMetadata templateMetadata = IndexTemplateMetadata.Builder.fromXContent(parser, parser.currentName()); + templates.add(templateMetadata); } } return new GetIndexTemplatesResponse(templates); @@ -64,8 +64,8 @@ public class GetIndexTemplatesResponse { @Override public int hashCode() { - List sortedList = new ArrayList<>(this.indexTemplates); - sortedList.sort(Comparator.comparing(IndexTemplateMetaData::name)); + List sortedList = new ArrayList<>(this.indexTemplates); + sortedList.sort(Comparator.comparing(IndexTemplateMetadata::name)); return Objects.hash(sortedList); } @@ -79,12 +79,12 @@ public class GetIndexTemplatesResponse { return false; // To compare results we need to make sure the templates are listed in the same order GetIndexTemplatesResponse other = (GetIndexTemplatesResponse) obj; - List thisList = new ArrayList<>(this.indexTemplates); - List otherList = new ArrayList<>(other.indexTemplates); - thisList.sort(Comparator.comparing(IndexTemplateMetaData::name)); - otherList.sort(Comparator.comparing(IndexTemplateMetaData::name)); + List thisList = new ArrayList<>(this.indexTemplates); + List otherList = new ArrayList<>(other.indexTemplates); + thisList.sort(Comparator.comparing(IndexTemplateMetadata::name)); + otherList.sort(Comparator.comparing(IndexTemplateMetadata::name)); return Objects.equals(thisList, otherList); } - - + + } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetMappingsResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetMappingsResponse.java index 54f569ab94b..281ce97b377 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetMappingsResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetMappingsResponse.java @@ -19,7 +19,7 @@ package org.elasticsearch.client.indices; -import org.elasticsearch.cluster.metadata.MappingMetaData; +import org.elasticsearch.cluster.metadata.MappingMetadata; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentParserUtils; @@ -33,13 +33,13 @@ public class GetMappingsResponse { static final ParseField MAPPINGS = new ParseField("mappings"); - private Map mappings; + private Map mappings; - public GetMappingsResponse(Map mappings) { + public GetMappingsResponse(Map mappings) { this.mappings = mappings; } - public Map mappings() { + public Map mappings() { return mappings; } @@ -54,7 +54,7 @@ public class GetMappingsResponse { Map parts = parser.map(); - Map mappings = new HashMap<>(); + Map mappings = new HashMap<>(); for (Map.Entry entry : parts.entrySet()) { String indexName = entry.getKey(); assert entry.getValue() instanceof Map : "expected a map as type mapping, but got: " + entry.getValue().getClass(); @@ -63,7 +63,7 @@ public class GetMappingsResponse { final Map fieldMappings = (Map) ((Map) entry.getValue()) .get(MAPPINGS.getPreferredName()); - mappings.put(indexName, new MappingMetaData(MapperService.SINGLE_MAPPING_NAME, fieldMappings)); + mappings.put(indexName, new MappingMetadata(MapperService.SINGLE_MAPPING_NAME, fieldMappings)); } return new GetMappingsResponse(mappings); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/IndexTemplateMetaData.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/IndexTemplateMetadata.java similarity index 76% rename from client/rest-high-level/src/main/java/org/elasticsearch/client/indices/IndexTemplateMetaData.java rename to client/rest-high-level/src/main/java/org/elasticsearch/client/indices/IndexTemplateMetadata.java index 51e5e3297f8..ee0a52175d6 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/IndexTemplateMetaData.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/IndexTemplateMetadata.java @@ -18,9 +18,9 @@ */ package org.elasticsearch.client.indices; -import org.elasticsearch.cluster.metadata.AliasMetaData; -import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.cluster.metadata.MappingMetaData; +import org.elasticsearch.cluster.metadata.AliasMetadata; +import org.elasticsearch.cluster.metadata.IndexMetadata; +import org.elasticsearch.cluster.metadata.MappingMetadata; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.collect.ImmutableOpenMap; @@ -38,23 +38,23 @@ import java.util.stream.Collectors; import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg; -public class IndexTemplateMetaData { +public class IndexTemplateMetadata { @SuppressWarnings("unchecked") - private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>( - "IndexTemplateMetaData", true, (a, name) -> { - List> alias = (List>) a[5]; - ImmutableOpenMap aliasMap = - new ImmutableOpenMap.Builder() + private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>( + "IndexTemplateMetadata", true, (a, name) -> { + List> alias = (List>) a[5]; + ImmutableOpenMap aliasMap = + new ImmutableOpenMap.Builder() .putAll(alias.stream().collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))) .build(); - return new IndexTemplateMetaData( + return new IndexTemplateMetadata( name, (Integer) a[0], (Integer) a[1], (List) a[2], (Settings) a[3], - (MappingMetaData) a[4], + (MappingMetadata) a[4], aliasMap); }); @@ -65,7 +65,7 @@ public class IndexTemplateMetaData { PARSER.declareObject(optionalConstructorArg(), (p, c) -> { Settings.Builder templateSettingsBuilder = Settings.builder(); templateSettingsBuilder.put(Settings.fromXContent(p)); - templateSettingsBuilder.normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX); + templateSettingsBuilder.normalizePrefix(IndexMetadata.INDEX_SETTING_PREFIX); return templateSettingsBuilder.build(); }, new ParseField("settings")); PARSER.declareObject(optionalConstructorArg(), (p, c) -> { @@ -73,10 +73,10 @@ public class IndexTemplateMetaData { if (mapping.isEmpty()) { return null; } - return new MappingMetaData(MapperService.SINGLE_MAPPING_NAME, mapping); + return new MappingMetadata(MapperService.SINGLE_MAPPING_NAME, mapping); }, new ParseField("mappings")); PARSER.declareNamedObjects(optionalConstructorArg(), - (p, c, name) -> new AbstractMap.SimpleEntry<>(name, AliasMetaData.Builder.fromXContent(p)), new ParseField("aliases")); + (p, c, name) -> new AbstractMap.SimpleEntry<>(name, AliasMetadata.Builder.fromXContent(p)), new ParseField("aliases")); } private final String name; @@ -107,14 +107,14 @@ public class IndexTemplateMetaData { private final Settings settings; - private final MappingMetaData mappings; + private final MappingMetadata mappings; - private final ImmutableOpenMap aliases; + private final ImmutableOpenMap aliases; - public IndexTemplateMetaData(String name, int order, Integer version, + public IndexTemplateMetadata(String name, int order, Integer version, List patterns, Settings settings, - MappingMetaData mappings, - ImmutableOpenMap aliases) { + MappingMetadata mappings, + ImmutableOpenMap aliases) { if (patterns == null || patterns.isEmpty()) { throw new IllegalArgumentException("Index patterns must not be null or empty; got " + patterns); } @@ -148,11 +148,11 @@ public class IndexTemplateMetaData { return this.settings; } - public MappingMetaData mappings() { + public MappingMetadata mappings() { return this.mappings; } - public ImmutableOpenMap aliases() { + public ImmutableOpenMap aliases() { return this.aliases; } @@ -164,7 +164,7 @@ public class IndexTemplateMetaData { public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - IndexTemplateMetaData that = (IndexTemplateMetaData) o; + IndexTemplateMetadata that = (IndexTemplateMetadata) o; return order == that.order && Objects.equals(name, that.name) && Objects.equals(version, that.version) && @@ -191,9 +191,9 @@ public class IndexTemplateMetaData { private Settings settings = Settings.Builder.EMPTY_SETTINGS; - private MappingMetaData mappings; + private MappingMetadata mappings; - private final ImmutableOpenMap.Builder aliases; + private final ImmutableOpenMap.Builder aliases; public Builder(String name) { this.name = name; @@ -201,15 +201,15 @@ public class IndexTemplateMetaData { aliases = ImmutableOpenMap.builder(); } - public Builder(IndexTemplateMetaData indexTemplateMetaData) { - this.name = indexTemplateMetaData.name(); - order(indexTemplateMetaData.order()); - version(indexTemplateMetaData.version()); - patterns(indexTemplateMetaData.patterns()); - settings(indexTemplateMetaData.settings()); + public Builder(IndexTemplateMetadata indexTemplateMetadata) { + this.name = indexTemplateMetadata.name(); + order(indexTemplateMetadata.order()); + version(indexTemplateMetadata.version()); + patterns(indexTemplateMetadata.patterns()); + settings(indexTemplateMetadata.settings()); - mappings = indexTemplateMetaData.mappings(); - aliases = ImmutableOpenMap.builder(indexTemplateMetaData.aliases()); + mappings = indexTemplateMetadata.mappings(); + aliases = ImmutableOpenMap.builder(indexTemplateMetadata.aliases()); } public Builder order(int order) { @@ -237,27 +237,27 @@ public class IndexTemplateMetaData { return this; } - public Builder mapping(MappingMetaData mappings) { + public Builder mapping(MappingMetadata mappings) { this.mappings = mappings; return this; } - public Builder putAlias(AliasMetaData aliasMetaData) { - aliases.put(aliasMetaData.alias(), aliasMetaData); + public Builder putAlias(AliasMetadata aliasMetadata) { + aliases.put(aliasMetadata.alias(), aliasMetadata); return this; } - public Builder putAlias(AliasMetaData.Builder aliasMetaData) { - aliases.put(aliasMetaData.alias(), aliasMetaData.build()); + public Builder putAlias(AliasMetadata.Builder aliasMetadata) { + aliases.put(aliasMetadata.alias(), aliasMetadata.build()); return this; } - public IndexTemplateMetaData build() { - return new IndexTemplateMetaData(name, order, version, indexPatterns, settings, mappings, aliases.build()); + public IndexTemplateMetadata build() { + return new IndexTemplateMetadata(name, order, version, indexPatterns, settings, mappings, aliases.build()); } - public static IndexTemplateMetaData fromXContent(XContentParser parser, String templateName) throws IOException { + public static IndexTemplateMetadata fromXContent(XContentParser parser, String templateName) throws IOException { return PARSER.parse(parser, templateName); } } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/rollup/GetRollupCapsRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/rollup/GetRollupCapsRequest.java index a5e215a71b2..b07089cf138 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/rollup/GetRollupCapsRequest.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/rollup/GetRollupCapsRequest.java @@ -19,7 +19,7 @@ package org.elasticsearch.client.rollup; import org.elasticsearch.client.Validatable; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.common.Strings; import org.elasticsearch.common.xcontent.ToXContentObject; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -33,7 +33,7 @@ public class GetRollupCapsRequest implements Validatable, ToXContentObject { public GetRollupCapsRequest(final String indexPattern) { if (Strings.isNullOrEmpty(indexPattern) || indexPattern.equals("*")) { - this.indexPattern = MetaData.ALL; + this.indexPattern = Metadata.ALL; } else { this.indexPattern = indexPattern; } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/WatcherMetaData.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/WatcherMetadata.java similarity index 91% rename from client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/WatcherMetaData.java rename to client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/WatcherMetadata.java index 1d84fb943f0..10bf006d23e 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/WatcherMetaData.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/WatcherMetadata.java @@ -21,11 +21,11 @@ package org.elasticsearch.client.watcher; import java.util.Objects; -public class WatcherMetaData { +public class WatcherMetadata { private final boolean manuallyStopped; - public WatcherMetaData(boolean manuallyStopped) { + public WatcherMetadata(boolean manuallyStopped) { this.manuallyStopped = manuallyStopped; } @@ -42,7 +42,7 @@ public class WatcherMetaData { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - WatcherMetaData action = (WatcherMetaData) o; + WatcherMetadata action = (WatcherMetadata) o; return manuallyStopped == action.manuallyStopped; } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/WatcherStatsResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/WatcherStatsResponse.java index 513adc8bd14..2ae12045fc8 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/WatcherStatsResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/WatcherStatsResponse.java @@ -40,21 +40,21 @@ public class WatcherStatsResponse { private final NodesResponseHeader header; private final String clusterName; - private final WatcherMetaData watcherMetaData; + private final WatcherMetadata watcherMetadata; - public WatcherStatsResponse(NodesResponseHeader header, String clusterName, WatcherMetaData watcherMetaData, List nodes) { + public WatcherStatsResponse(NodesResponseHeader header, String clusterName, WatcherMetadata watcherMetadata, List nodes) { this.nodes = nodes; this.header = header; this.clusterName = clusterName; - this.watcherMetaData = watcherMetaData; + this.watcherMetadata = watcherMetadata; } /** * @return the status of the requested watch. If an action was * successfully acknowledged, this will be reflected in its status. */ - public WatcherMetaData getWatcherMetaData() { - return watcherMetaData; + public WatcherMetadata getWatcherMetadata() { + return watcherMetadata; } /** @@ -84,7 +84,7 @@ public class WatcherStatsResponse { @SuppressWarnings("unchecked") private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>("watcher_stats_response", true, - a -> new WatcherStatsResponse((NodesResponseHeader) a[0], (String) a[1], new WatcherMetaData((boolean) a[2]), + a -> new WatcherStatsResponse((NodesResponseHeader) a[0], (String) a[1], new WatcherMetadata((boolean) a[2]), (List) a[3])); static { @@ -107,13 +107,13 @@ public class WatcherStatsResponse { return Objects.equals(nodes, that.nodes) && Objects.equals(header, that.header) && Objects.equals(clusterName, that.clusterName) && - Objects.equals(watcherMetaData, that.watcherMetaData); + Objects.equals(watcherMetadata, that.watcherMetadata); } @Override public int hashCode() { - return Objects.hash(nodes, header, clusterName, watcherMetaData); + return Objects.hash(nodes, header, clusterName, watcherMetadata); } public static class Node { diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/GetAliasesResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/GetAliasesResponseTests.java index 92210521b3d..89d52a01270 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/GetAliasesResponseTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/GetAliasesResponseTests.java @@ -19,7 +19,7 @@ package org.elasticsearch.client; -import org.elasticsearch.cluster.metadata.AliasMetaData; +import org.elasticsearch.cluster.metadata.AliasMetadata; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.rest.RestStatus; @@ -44,23 +44,23 @@ public class GetAliasesResponseTests extends AbstractXContentTestCase> createIndicesAliasesMap(int min, int max) { - Map> map = new HashMap<>(); + private static Map> createIndicesAliasesMap(int min, int max) { + Map> map = new HashMap<>(); int indicesNum = randomIntBetween(min, max); for (int i = 0; i < indicesNum; i++) { String index = randomAlphaOfLength(5); - Set aliasMetaData = new HashSet<>(); + Set aliasMetadata = new HashSet<>(); int aliasesNum = randomIntBetween(0, 3); for (int alias = 0; alias < aliasesNum; alias++) { - aliasMetaData.add(createAliasMetaData()); + aliasMetadata.add(createAliasMetadata()); } - map.put(index, aliasMetaData); + map.put(index, aliasMetadata); } return map; } - public static AliasMetaData createAliasMetaData() { - AliasMetaData.Builder builder = AliasMetaData.builder(randomAlphaOfLengthBetween(3, 10)); + public static AliasMetadata createAliasMetadata() { + AliasMetadata.Builder builder = AliasMetadata.builder(randomAlphaOfLengthBetween(3, 10)); if (randomBoolean()) { builder.routing(randomAlphaOfLengthBetween(3, 10)); } @@ -85,7 +85,7 @@ public class GetAliasesResponseTests extends AbstractXContentTestCase getRandomFieldsExcludeFilter() { return p -> p.equals("") // do not add elements at the top-level as any element at this level is parsed as a new index || p.endsWith(".aliases") // do not add new alias - || p.contains(".filter"); // do not insert random data into AliasMetaData#filter + || p.contains(".filter"); // do not insert random data into AliasMetadata#filter } @Override @@ -167,8 +167,8 @@ public class GetAliasesResponseTests extends AbstractXContentTestCase) o).get("field-1"), instanceOf(Map.class)); @@ -479,10 +479,10 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { assertEquals("1", getIndexResponse.getSetting(indexName, SETTING_NUMBER_OF_SHARDS)); assertEquals("0", getIndexResponse.getSetting(indexName, SETTING_NUMBER_OF_REPLICAS)); assertNotNull(getIndexResponse.getMappings().get(indexName)); - MappingMetaData mappingMetaData = getIndexResponse.getMappings().get(indexName).get("_doc"); - assertNotNull(mappingMetaData); - assertEquals("_doc", mappingMetaData.type()); - assertEquals("{\"properties\":{\"field-1\":{\"type\":\"integer\"}}}", mappingMetaData.source().string()); + MappingMetadata mappingMetadata = getIndexResponse.getMappings().get(indexName).get("_doc"); + assertNotNull(mappingMetadata); + assertEquals("_doc", mappingMetadata.type()); + assertEquals("{\"properties\":{\"field-1\":{\"type\":\"integer\"}}}", mappingMetadata.source().string()); } @SuppressWarnings("unchecked") @@ -667,13 +667,13 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { highLevelClient().indices()::getFieldMapping, highLevelClient().indices()::getFieldMappingAsync); - final Map fieldMappingMap = + final Map fieldMappingMap = getFieldMappingsResponse.mappings().get(indexName); - final GetFieldMappingsResponse.FieldMappingMetaData metaData = - new GetFieldMappingsResponse.FieldMappingMetaData("field", + final GetFieldMappingsResponse.FieldMappingMetadata metadata = + new GetFieldMappingsResponse.FieldMappingMetadata("field", new BytesArray("{\"field\":{\"type\":\"text\"}}")); - assertThat(fieldMappingMap, equalTo(Collections.singletonMap("field", metaData))); + assertThat(fieldMappingMap, equalTo(Collections.singletonMap("field", metadata))); } public void testGetFieldMappingWithTypes() throws IOException { @@ -703,13 +703,13 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { highLevelClient().indices()::getFieldMappingAsync, expectWarnings(RestGetFieldMappingAction.TYPES_DEPRECATION_MESSAGE)); - final Map + final Map fieldMappingMap = getFieldMappingsResponse.mappings().get(indexName).get("_doc"); - final org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetaData metaData = - new org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetaData("field", + final org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetadata metadata = + new org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetadata("field", new BytesArray("{\"field\":{\"type\":\"text\"}}")); - assertThat(fieldMappingMap, equalTo(Collections.singletonMap("field", metaData))); + assertThat(fieldMappingMap, equalTo(Collections.singletonMap("field", metadata))); } public void testDeleteIndex() throws IOException { @@ -1258,12 +1258,12 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { assertThat(getAliasesResponse.getAliases().size(), equalTo(1)); assertThat(getAliasesResponse.getAliases().get("index1").size(), equalTo(1)); - AliasMetaData aliasMetaData = getAliasesResponse.getAliases().get("index1").iterator().next(); - assertThat(aliasMetaData, notNullValue()); - assertThat(aliasMetaData.alias(), equalTo("alias1")); - assertThat(aliasMetaData.getFilter(), nullValue()); - assertThat(aliasMetaData.getIndexRouting(), nullValue()); - assertThat(aliasMetaData.getSearchRouting(), nullValue()); + AliasMetadata aliasMetadata = getAliasesResponse.getAliases().get("index1").iterator().next(); + assertThat(aliasMetadata, notNullValue()); + assertThat(aliasMetadata.alias(), equalTo("alias1")); + assertThat(aliasMetadata.getFilter(), nullValue()); + assertThat(aliasMetadata.getIndexRouting(), nullValue()); + assertThat(aliasMetadata.getSearchRouting(), nullValue()); } { GetAliasesRequest getAliasesRequest = new GetAliasesRequest().aliases("alias*"); @@ -1272,13 +1272,13 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { assertThat(getAliasesResponse.getAliases().size(), equalTo(2)); assertThat(getAliasesResponse.getAliases().get("index1").size(), equalTo(1)); - AliasMetaData aliasMetaData1 = getAliasesResponse.getAliases().get("index1").iterator().next(); - assertThat(aliasMetaData1, notNullValue()); - assertThat(aliasMetaData1.alias(), equalTo("alias1")); + AliasMetadata aliasMetadata1 = getAliasesResponse.getAliases().get("index1").iterator().next(); + assertThat(aliasMetadata1, notNullValue()); + assertThat(aliasMetadata1.alias(), equalTo("alias1")); assertThat(getAliasesResponse.getAliases().get("index2").size(), equalTo(1)); - AliasMetaData aliasMetaData2 = getAliasesResponse.getAliases().get("index2").iterator().next(); - assertThat(aliasMetaData2, notNullValue()); - assertThat(aliasMetaData2.alias(), equalTo("alias2")); + AliasMetadata aliasMetadata2 = getAliasesResponse.getAliases().get("index2").iterator().next(); + assertThat(aliasMetadata2, notNullValue()); + assertThat(aliasMetadata2.alias(), equalTo("alias2")); } { GetAliasesRequest getAliasesRequest = new GetAliasesRequest().aliases("_all"); @@ -1287,13 +1287,13 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { assertThat(getAliasesResponse.getAliases().size(), equalTo(2)); assertThat(getAliasesResponse.getAliases().get("index1").size(), equalTo(1)); - AliasMetaData aliasMetaData1 = getAliasesResponse.getAliases().get("index1").iterator().next(); - assertThat(aliasMetaData1, notNullValue()); - assertThat(aliasMetaData1.alias(), equalTo("alias1")); + AliasMetadata aliasMetadata1 = getAliasesResponse.getAliases().get("index1").iterator().next(); + assertThat(aliasMetadata1, notNullValue()); + assertThat(aliasMetadata1.alias(), equalTo("alias1")); assertThat(getAliasesResponse.getAliases().get("index2").size(), equalTo(1)); - AliasMetaData aliasMetaData2 = getAliasesResponse.getAliases().get("index2").iterator().next(); - assertThat(aliasMetaData2, notNullValue()); - assertThat(aliasMetaData2.alias(), equalTo("alias2")); + AliasMetadata aliasMetadata2 = getAliasesResponse.getAliases().get("index2").iterator().next(); + assertThat(aliasMetadata2, notNullValue()); + assertThat(aliasMetadata2.alias(), equalTo("alias2")); } { GetAliasesRequest getAliasesRequest = new GetAliasesRequest().aliases("*"); @@ -1302,13 +1302,13 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { assertThat(getAliasesResponse.getAliases().size(), equalTo(2)); assertThat(getAliasesResponse.getAliases().get("index1").size(), equalTo(1)); - AliasMetaData aliasMetaData1 = getAliasesResponse.getAliases().get("index1").iterator().next(); - assertThat(aliasMetaData1, notNullValue()); - assertThat(aliasMetaData1.alias(), equalTo("alias1")); + AliasMetadata aliasMetadata1 = getAliasesResponse.getAliases().get("index1").iterator().next(); + assertThat(aliasMetadata1, notNullValue()); + assertThat(aliasMetadata1.alias(), equalTo("alias1")); assertThat(getAliasesResponse.getAliases().get("index2").size(), equalTo(1)); - AliasMetaData aliasMetaData2 = getAliasesResponse.getAliases().get("index2").iterator().next(); - assertThat(aliasMetaData2, notNullValue()); - assertThat(aliasMetaData2.alias(), equalTo("alias2")); + AliasMetadata aliasMetadata2 = getAliasesResponse.getAliases().get("index2").iterator().next(); + assertThat(aliasMetadata2, notNullValue()); + assertThat(aliasMetadata2.alias(), equalTo("alias2")); } { GetAliasesRequest getAliasesRequest = new GetAliasesRequest().indices("_all"); @@ -1318,13 +1318,13 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { assertThat("Unexpected number of aliases, got: " + getAliasesResponse.getAliases().toString(), getAliasesResponse.getAliases().size(), equalTo(3)); assertThat(getAliasesResponse.getAliases().get("index1").size(), equalTo(1)); - AliasMetaData aliasMetaData1 = getAliasesResponse.getAliases().get("index1").iterator().next(); - assertThat(aliasMetaData1, notNullValue()); - assertThat(aliasMetaData1.alias(), equalTo("alias1")); + AliasMetadata aliasMetadata1 = getAliasesResponse.getAliases().get("index1").iterator().next(); + assertThat(aliasMetadata1, notNullValue()); + assertThat(aliasMetadata1.alias(), equalTo("alias1")); assertThat(getAliasesResponse.getAliases().get("index2").size(), equalTo(1)); - AliasMetaData aliasMetaData2 = getAliasesResponse.getAliases().get("index2").iterator().next(); - assertThat(aliasMetaData2, notNullValue()); - assertThat(aliasMetaData2.alias(), equalTo("alias2")); + AliasMetadata aliasMetadata2 = getAliasesResponse.getAliases().get("index2").iterator().next(); + assertThat(aliasMetadata2, notNullValue()); + assertThat(aliasMetadata2.alias(), equalTo("alias2")); assertThat(getAliasesResponse.getAliases().get("index3").size(), equalTo(0)); } { @@ -1334,13 +1334,13 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { assertThat(getAliasesResponse.getAliases().size(), equalTo(3)); assertThat(getAliasesResponse.getAliases().get("index1").size(), equalTo(1)); - AliasMetaData aliasMetaData1 = getAliasesResponse.getAliases().get("index1").iterator().next(); - assertThat(aliasMetaData1, notNullValue()); - assertThat(aliasMetaData1.alias(), equalTo("alias1")); + AliasMetadata aliasMetadata1 = getAliasesResponse.getAliases().get("index1").iterator().next(); + assertThat(aliasMetadata1, notNullValue()); + assertThat(aliasMetadata1.alias(), equalTo("alias1")); assertThat(getAliasesResponse.getAliases().get("index2").size(), equalTo(1)); - AliasMetaData aliasMetaData2 = getAliasesResponse.getAliases().get("index2").iterator().next(); - assertThat(aliasMetaData2, notNullValue()); - assertThat(aliasMetaData2.alias(), equalTo("alias2")); + AliasMetadata aliasMetadata2 = getAliasesResponse.getAliases().get("index2").iterator().next(); + assertThat(aliasMetadata2, notNullValue()); + assertThat(aliasMetadata2.alias(), equalTo("alias2")); assertThat(getAliasesResponse.getAliases().get("index3").size(), equalTo(0)); } { @@ -1350,13 +1350,13 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { assertThat(getAliasesResponse.getAliases().size(), equalTo(3)); assertThat(getAliasesResponse.getAliases().get("index1").size(), equalTo(1)); - AliasMetaData aliasMetaData1 = getAliasesResponse.getAliases().get("index1").iterator().next(); - assertThat(aliasMetaData1, notNullValue()); - assertThat(aliasMetaData1.alias(), equalTo("alias1")); + AliasMetadata aliasMetadata1 = getAliasesResponse.getAliases().get("index1").iterator().next(); + assertThat(aliasMetadata1, notNullValue()); + assertThat(aliasMetadata1.alias(), equalTo("alias1")); assertThat(getAliasesResponse.getAliases().get("index2").size(), equalTo(1)); - AliasMetaData aliasMetaData2 = getAliasesResponse.getAliases().get("index2").iterator().next(); - assertThat(aliasMetaData2, notNullValue()); - assertThat(aliasMetaData2.alias(), equalTo("alias2")); + AliasMetadata aliasMetadata2 = getAliasesResponse.getAliases().get("index2").iterator().next(); + assertThat(aliasMetadata2, notNullValue()); + assertThat(aliasMetadata2.alias(), equalTo("alias2")); assertThat(getAliasesResponse.getAliases().get("index3").size(), equalTo(0)); } } @@ -1423,9 +1423,9 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { assertThat(getAliasesResponse.getAliases().size(), equalTo(1)); assertThat(getAliasesResponse.getAliases().get(index).size(), equalTo(1)); - AliasMetaData aliasMetaData = getAliasesResponse.getAliases().get(index).iterator().next(); - assertThat(aliasMetaData, notNullValue()); - assertThat(aliasMetaData.alias(), equalTo(alias)); + AliasMetadata aliasMetadata = getAliasesResponse.getAliases().get(index).iterator().next(); + assertThat(aliasMetadata, notNullValue()); + assertThat(aliasMetadata.alias(), equalTo(alias)); /* This is the above response in json format: { @@ -1450,16 +1450,16 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { public void testIndexPutSettings() throws IOException { - final Setting dynamicSetting = IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING; - final String dynamicSettingKey = IndexMetaData.SETTING_NUMBER_OF_REPLICAS; + final Setting dynamicSetting = IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING; + final String dynamicSettingKey = IndexMetadata.SETTING_NUMBER_OF_REPLICAS; final int dynamicSettingValue = 0; final Setting staticSetting = IndexSettings.INDEX_CHECK_ON_STARTUP; final String staticSettingKey = IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(); final String staticSettingValue = "true"; - final Setting unmodifiableSetting = IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING; - final String unmodifiableSettingKey = IndexMetaData.SETTING_NUMBER_OF_SHARDS; + final Setting unmodifiableSetting = IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING; + final String unmodifiableSettingKey = IndexMetadata.SETTING_NUMBER_OF_SHARDS; final int unmodifiableSettingValue = 3; String index = "index"; @@ -1783,7 +1783,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { client.indices()::getTemplate, client.indices()::getTemplateAsync, expectWarnings(RestGetIndexTemplateAction.TYPES_DEPRECATION_MESSAGE)); assertThat(getTemplate1.getIndexTemplates(), hasSize(1)); - org.elasticsearch.cluster.metadata.IndexTemplateMetaData template1 = getTemplate1.getIndexTemplates().get(0); + org.elasticsearch.cluster.metadata.IndexTemplateMetadata template1 = getTemplate1.getIndexTemplates().get(0); assertThat(template1.name(), equalTo("template-1")); assertThat(template1.patterns(), contains("pattern-1", "name-1")); assertTrue(template1.aliases().containsKey("alias-1")); @@ -1794,7 +1794,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { client.indices()::getTemplate, client.indices()::getTemplateAsync, expectWarnings(RestGetIndexTemplateAction.TYPES_DEPRECATION_MESSAGE)); assertThat(getTemplate2.getIndexTemplates(), hasSize(1)); - org.elasticsearch.cluster.metadata.IndexTemplateMetaData template2 = getTemplate2.getIndexTemplates().get(0); + org.elasticsearch.cluster.metadata.IndexTemplateMetadata template2 = getTemplate2.getIndexTemplates().get(0); assertThat(template2.name(), equalTo("template-2")); assertThat(template2.patterns(), contains("pattern-2", "name-2")); assertTrue(template2.aliases().isEmpty()); @@ -1811,7 +1811,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { getBothRequest, client.indices()::getTemplate, client.indices()::getTemplateAsync, expectWarnings(RestGetIndexTemplateAction.TYPES_DEPRECATION_MESSAGE)); assertThat(getBoth.getIndexTemplates(), hasSize(2)); - assertThat(getBoth.getIndexTemplates().stream().map(org.elasticsearch.cluster.metadata.IndexTemplateMetaData::getName).toArray(), + assertThat(getBoth.getIndexTemplates().stream().map(org.elasticsearch.cluster.metadata.IndexTemplateMetadata::getName).toArray(), arrayContainingInAnyOrder("template-1", "template-2")); GetIndexTemplatesRequest getAllRequest = new GetIndexTemplatesRequest(); @@ -1819,7 +1819,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { getAllRequest, client.indices()::getTemplate, client.indices()::getTemplateAsync, expectWarnings(RestGetIndexTemplateAction.TYPES_DEPRECATION_MESSAGE)); assertThat(getAll.getIndexTemplates().size(), greaterThanOrEqualTo(2)); - assertThat(getAll.getIndexTemplates().stream().map(org.elasticsearch.cluster.metadata.IndexTemplateMetaData::getName) + assertThat(getAll.getIndexTemplates().stream().map(org.elasticsearch.cluster.metadata.IndexTemplateMetadata::getName) .collect(Collectors.toList()), hasItems("template-1", "template-2")); @@ -1864,7 +1864,7 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { new GetIndexTemplatesRequest("template-1"), client.indices()::getIndexTemplate, client.indices()::getIndexTemplateAsync); assertThat(getTemplate1.getIndexTemplates(), hasSize(1)); - IndexTemplateMetaData template1 = getTemplate1.getIndexTemplates().get(0); + IndexTemplateMetadata template1 = getTemplate1.getIndexTemplates().get(0); assertThat(template1.name(), equalTo("template-1")); assertThat(template1.patterns(), contains("pattern-1", "name-1")); assertTrue(template1.aliases().containsKey("alias-1")); @@ -1872,13 +1872,13 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { GetIndexTemplatesResponse getTemplate2 = execute(new GetIndexTemplatesRequest("template-2"), client.indices()::getIndexTemplate, client.indices()::getIndexTemplateAsync); assertThat(getTemplate2.getIndexTemplates(), hasSize(1)); - IndexTemplateMetaData template2 = getTemplate2.getIndexTemplates().get(0); + IndexTemplateMetadata template2 = getTemplate2.getIndexTemplates().get(0); assertThat(template2.name(), equalTo("template-2")); assertThat(template2.patterns(), contains("pattern-2", "name-2")); assertTrue(template2.aliases().isEmpty()); assertThat(template2.settings().get("index.number_of_shards"), equalTo("2")); assertThat(template2.settings().get("index.number_of_replicas"), equalTo("0")); - // New API returns a MappingMetaData class rather than CompressedXContent for the mapping + // New API returns a MappingMetadata class rather than CompressedXContent for the mapping assertTrue(template2.mappings().sourceAsMap().containsKey("properties")); @SuppressWarnings("unchecked") Map props = (Map) template2.mappings().sourceAsMap().get("properties"); @@ -1893,14 +1893,14 @@ public class IndicesClientIT extends ESRestHighLevelClientTestCase { GetIndexTemplatesResponse getBoth = execute( getBothRequest, client.indices()::getIndexTemplate, client.indices()::getIndexTemplateAsync); assertThat(getBoth.getIndexTemplates(), hasSize(2)); - assertThat(getBoth.getIndexTemplates().stream().map(IndexTemplateMetaData::name).toArray(), + assertThat(getBoth.getIndexTemplates().stream().map(IndexTemplateMetadata::name).toArray(), arrayContainingInAnyOrder("template-1", "template-2")); GetIndexTemplatesRequest getAllRequest = new GetIndexTemplatesRequest(); GetIndexTemplatesResponse getAll = execute( getAllRequest, client.indices()::getIndexTemplate, client.indices()::getIndexTemplateAsync); assertThat(getAll.getIndexTemplates().size(), greaterThanOrEqualTo(2)); - assertThat(getAll.getIndexTemplates().stream().map(IndexTemplateMetaData::name) + assertThat(getAll.getIndexTemplates().stream().map(IndexTemplateMetadata::name) .collect(Collectors.toList()), hasItems("template-1", "template-2")); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/WatcherIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/WatcherIT.java index 23a38b47249..bdaf88f5a7a 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/WatcherIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/WatcherIT.java @@ -61,7 +61,7 @@ public class WatcherIT extends ESRestHighLevelClientTestCase { assertTrue(response.isAcknowledged()); WatcherStatsResponse stats = highLevelClient().watcher().watcherStats(new WatcherStatsRequest(), RequestOptions.DEFAULT); - assertFalse(stats.getWatcherMetaData().manuallyStopped()); + assertFalse(stats.getWatcherMetadata().manuallyStopped()); assertThat(stats.getNodes(), not(empty())); for(WatcherStatsResponse.Node node : stats.getNodes()) { assertEquals(WatcherState.STARTED, node.getWatcherState()); @@ -74,7 +74,7 @@ public class WatcherIT extends ESRestHighLevelClientTestCase { assertTrue(response.isAcknowledged()); WatcherStatsResponse stats = highLevelClient().watcher().watcherStats(new WatcherStatsRequest(), RequestOptions.DEFAULT); - assertTrue(stats.getWatcherMetaData().manuallyStopped()); + assertTrue(stats.getWatcherMetadata().manuallyStopped()); } public void testPutWatch() throws Exception { diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/core/CountResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/core/CountResponseTests.java index c2fc668d604..5a622088a83 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/core/CountResponseTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/core/CountResponseTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.client.core; import org.elasticsearch.action.search.ShardSearchFailure; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -91,7 +91,7 @@ public class CountResponseTests extends ESTestCase { String nodeId = randomAlphaOfLengthBetween(5, 10); String indexName = randomAlphaOfLengthBetween(5, 10); searchShardTarget = new SearchShardTarget(nodeId, - new ShardId(new Index(indexName, IndexMetaData.INDEX_UUID_NA_VALUE), randomInt()), null, null); + new ShardId(new Index(indexName, IndexMetadata.INDEX_UUID_NA_VALUE), randomInt()), null, null); } return new ShardSearchFailure(ex, searchShardTarget); } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/ILMDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/ILMDocumentationIT.java index 887fb510bca..2744d34423c 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/ILMDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/ILMDocumentationIT.java @@ -69,7 +69,7 @@ import org.elasticsearch.client.slm.SnapshotLifecycleStats; import org.elasticsearch.client.slm.SnapshotRetentionConfiguration; import org.elasticsearch.client.slm.StartSLMRequest; import org.elasticsearch.client.slm.StopSLMRequest; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Strings; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.settings.Settings; @@ -361,7 +361,7 @@ public class ILMDocumentationIT extends ESRestHighLevelClientTestCase { CreateIndexRequest createIndexRequest = new CreateIndexRequest("my_index-1") .settings(Settings.builder() - .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) + .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put("index.lifecycle.name", "my_policy") .put("index.lifecycle.rollover_alias", "my_alias") .build()); @@ -369,7 +369,7 @@ public class ILMDocumentationIT extends ESRestHighLevelClientTestCase { client.indices().create(createIndexRequest, RequestOptions.DEFAULT); CreateIndexRequest createOtherIndexRequest = new CreateIndexRequest("other_index") .settings(Settings.builder() - .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) + .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .build()); client.indices().create(createOtherIndexRequest, RequestOptions.DEFAULT); @@ -623,7 +623,7 @@ public class ILMDocumentationIT extends ESRestHighLevelClientTestCase { CreateIndexRequest createIndexRequest = new CreateIndexRequest("my_index") .settings(Settings.builder() - .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 2) + .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 2) .put("index.lifecycle.name", "my_policy") .build()); client.indices().create(createIndexRequest, RequestOptions.DEFAULT); @@ -688,7 +688,7 @@ public class ILMDocumentationIT extends ESRestHighLevelClientTestCase { client.indexLifecycle().putLifecyclePolicy(putRequest, RequestOptions.DEFAULT); CreateIndexRequest createIndexRequest = new CreateIndexRequest("my_index") .settings(Settings.builder() - .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) + .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put("index.lifecycle.name", "my_policy") .build()); client.indices().create(createIndexRequest, RequestOptions.DEFAULT); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java index 84dd36b198c..17442f108c2 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java @@ -76,7 +76,7 @@ import org.elasticsearch.client.indices.GetIndexTemplatesRequest; import org.elasticsearch.client.indices.GetIndexTemplatesResponse; import org.elasticsearch.client.indices.GetMappingsRequest; import org.elasticsearch.client.indices.GetMappingsResponse; -import org.elasticsearch.client.indices.IndexTemplateMetaData; +import org.elasticsearch.client.indices.IndexTemplateMetadata; import org.elasticsearch.client.indices.IndexTemplatesExistRequest; import org.elasticsearch.client.indices.PutIndexTemplateRequest; import org.elasticsearch.client.indices.PutMappingRequest; @@ -86,8 +86,8 @@ import org.elasticsearch.client.indices.ReloadAnalyzersResponse.ReloadDetails; import org.elasticsearch.client.indices.UnfreezeIndexRequest; import org.elasticsearch.client.indices.rollover.RolloverRequest; import org.elasticsearch.client.indices.rollover.RolloverResponse; -import org.elasticsearch.cluster.metadata.AliasMetaData; -import org.elasticsearch.cluster.metadata.MappingMetaData; +import org.elasticsearch.cluster.metadata.AliasMetadata; +import org.elasticsearch.cluster.metadata.MappingMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; @@ -593,8 +593,8 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase // end::get-mappings-execute // tag::get-mappings-response - Map allMappings = getMappingResponse.mappings(); // <1> - MappingMetaData indexMapping = allMappings.get("twitter"); // <2> + Map allMappings = getMappingResponse.mappings(); // <1> + MappingMetadata indexMapping = allMappings.get("twitter"); // <2> Map mapping = indexMapping.sourceAsMap(); // <3> // end::get-mappings-response @@ -645,8 +645,8 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase final CountDownLatch latch = new CountDownLatch(1); final ActionListener latchListener = new LatchedActionListener<>(listener, latch); listener = ActionListener.wrap(r -> { - Map allMappings = r.mappings(); - MappingMetaData indexMapping = allMappings.get("twitter"); + Map allMappings = r.mappings(); + MappingMetadata indexMapping = allMappings.get("twitter"); Map mapping = indexMapping.sourceAsMap(); Map type = new HashMap<>(); @@ -716,15 +716,15 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase // end::get-field-mappings-execute // tag::get-field-mappings-response - final Map> mappings = + final Map> mappings = response.mappings();// <1> - final Map fieldMappings = + final Map fieldMappings = mappings.get("twitter"); // <2> - final GetFieldMappingsResponse.FieldMappingMetaData metaData = + final GetFieldMappingsResponse.FieldMappingMetadata metadata = fieldMappings.get("message");// <3> - final String fullName = metaData.fullName();// <4> - final Map source = metaData.sourceAsMap(); // <5> + final String fullName = metadata.fullName();// <4> + final Map source = metadata.sourceAsMap(); // <5> // end::get-field-mappings-response } @@ -748,14 +748,14 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase final CountDownLatch latch = new CountDownLatch(1); final ActionListener latchListener = new LatchedActionListener<>(listener, latch); listener = ActionListener.wrap(r -> { - final Map> mappings = + final Map> mappings = r.mappings(); - final Map fieldMappings = + final Map fieldMappings = mappings.get("twitter"); - final GetFieldMappingsResponse.FieldMappingMetaData metaData1 = fieldMappings.get("message"); + final GetFieldMappingsResponse.FieldMappingMetadata metadata1 = fieldMappings.get("message"); - final String fullName = metaData1.fullName(); - final Map source = metaData1.sourceAsMap(); + final String fullName = metadata1.fullName(); + final Map source = metadata1.sourceAsMap(); latchListener.onResponse(r); }, e -> { latchListener.onFailure(e); @@ -1234,9 +1234,9 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase // end::get-index-execute // tag::get-index-response - MappingMetaData indexMappings = getIndexResponse.getMappings().get("index"); // <1> + MappingMetadata indexMappings = getIndexResponse.getMappings().get("index"); // <1> Map indexTypeMappings = indexMappings.getSourceAsMap(); // <2> - List indexAliases = getIndexResponse.getAliases().get("index"); // <3> + List indexAliases = getIndexResponse.getAliases().get("index"); // <3> String numberOfShardsString = getIndexResponse.getSetting("index", "index.number_of_shards"); // <4> Settings indexSettings = getIndexResponse.getSettings().get("index"); // <5> Integer numberOfShards = indexSettings.getAsInt("index.number_of_shards", null); // <6> @@ -1998,7 +1998,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase // end::get-alias-execute // tag::get-alias-response - Map> aliases = response.getAliases(); // <1> + Map> aliases = response.getAliases(); // <1> // end::get-alias-response // tag::get-alias-response-error @@ -2320,7 +2320,7 @@ public class IndicesClientDocumentationIT extends ESRestHighLevelClientTestCase // end::get-templates-execute // tag::get-templates-response - List templates = getTemplatesResponse.getIndexTemplates(); // <1> + List templates = getTemplatesResponse.getIndexTemplates(); // <1> // end::get-templates-response assertThat(templates, hasSize(1)); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/SnapshotClientDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/SnapshotClientDocumentationIT.java index a39e3145aea..33b5480d2d5 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/SnapshotClientDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/SnapshotClientDocumentationIT.java @@ -47,7 +47,7 @@ import org.elasticsearch.client.Response; import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.indices.CreateIndexRequest; import org.elasticsearch.cluster.SnapshotsInProgress; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.common.Booleans; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; @@ -234,10 +234,10 @@ public class SnapshotClientDocumentationIT extends ESRestHighLevelClientTestCase // end::get-repository-execute // tag::get-repository-response - List repositoryMetaDataResponse = response.repositories(); + List repositoryMetadataResponse = response.repositories(); // end::get-repository-response - assertThat(1, equalTo(repositoryMetaDataResponse.size())); - assertThat(repositoryName, equalTo(repositoryMetaDataResponse.get(0).name())); + assertThat(1, equalTo(repositoryMetadataResponse.size())); + assertThat(repositoryName, equalTo(repositoryMetadataResponse.get(0).name())); } public void testSnapshotGetRepositoryAsync() throws InterruptedException { @@ -455,14 +455,14 @@ public class SnapshotClientDocumentationIT extends ESRestHighLevelClientTestCase // end::verify-repository-execute // tag::verify-repository-response - List repositoryMetaDataResponse = response.getNodes(); + List repositoryMetadataResponse = response.getNodes(); // end::verify-repository-response - assertThat(1, equalTo(repositoryMetaDataResponse.size())); + assertThat(1, equalTo(repositoryMetadataResponse.size())); final boolean async = Booleans.parseBoolean(System.getProperty("tests.rest.async", "false")); if (async) { - assertThat("asyncIntegTest-0", equalTo(repositoryMetaDataResponse.get(0).getName())); + assertThat("asyncIntegTest-0", equalTo(repositoryMetadataResponse.get(0).getName())); } else { - assertThat("integTest-0", equalTo(repositoryMetaDataResponse.get(0).getName())); + assertThat("integTest-0", equalTo(repositoryMetadataResponse.get(0).getName())); } } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetFieldMappingsResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetFieldMappingsResponseTests.java index 827b2f005ae..a8c3e7b62ad 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetFieldMappingsResponseTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetFieldMappingsResponseTests.java @@ -19,7 +19,7 @@ package org.elasticsearch.client.indices; -import org.elasticsearch.client.indices.GetFieldMappingsResponse.FieldMappingMetaData; +import org.elasticsearch.client.indices.GetFieldMappingsResponse.FieldMappingMetadata; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.test.ESTestCase; @@ -52,18 +52,18 @@ public class GetFieldMappingsResponseTests extends ESTestCase { } private static GetFieldMappingsResponse createTestInstance() { - Map> mappings = new HashMap<>(); + Map> mappings = new HashMap<>(); // if mappings is empty, means that fields are not found if (randomBoolean()) { int indices = randomInt(10); for (int i = 0; i < indices; i++) { - Map fieldMappings = new HashMap<>(); + Map fieldMappings = new HashMap<>(); int fields = randomInt(10); for (int k = 0; k < fields; k++) { final String mapping = randomBoolean() ? "{\"type\":\"string\"}" : "{\"type\":\"keyword\"}"; final String fieldName = randomAlphaOfLength(8); - FieldMappingMetaData metaData = new FieldMappingMetaData(fieldName, new BytesArray(mapping)); - fieldMappings.put(fieldName, metaData); + FieldMappingMetadata metadata = new FieldMappingMetadata(fieldName, new BytesArray(mapping)); + fieldMappings.put(fieldName, metadata); } mappings.put(randomAlphaOfLength(8), fieldMappings); } @@ -74,10 +74,10 @@ public class GetFieldMappingsResponseTests extends ESTestCase { // As the client class GetFieldMappingsResponse doesn't have toXContent method, adding this method here only for the test private static void toXContent(GetFieldMappingsResponse response, XContentBuilder builder) throws IOException { builder.startObject(); - for (Map.Entry> indexEntry : response.mappings().entrySet()) { + for (Map.Entry> indexEntry : response.mappings().entrySet()) { builder.startObject(indexEntry.getKey()); builder.startObject("mappings"); - for (Map.Entry fieldEntry : indexEntry.getValue().entrySet()) { + for (Map.Entry fieldEntry : indexEntry.getValue().entrySet()) { builder.startObject(fieldEntry.getKey()); builder.field("full_name", fieldEntry.getValue().fullName()); builder.field("mapping", fieldEntry.getValue().sourceAsMap()); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetIndexResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetIndexResponseTests.java index 19c25fd11f6..067d503803e 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetIndexResponseTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetIndexResponseTests.java @@ -21,8 +21,8 @@ package org.elasticsearch.client.indices; import org.apache.lucene.util.CollectionUtil; import org.elasticsearch.client.GetAliasesResponseTests; -import org.elasticsearch.cluster.metadata.AliasMetaData; -import org.elasticsearch.cluster.metadata.MappingMetaData; +import org.elasticsearch.cluster.metadata.AliasMetadata; +import org.elasticsearch.cluster.metadata.MappingMetadata; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.settings.IndexScopedSettings; import org.elasticsearch.common.settings.Settings; @@ -72,8 +72,8 @@ public class GetIndexResponseTests extends ESTestCase { private static GetIndexResponse createTestInstance() { String[] indices = generateRandomStringArray(5, 5, false, false); - Map mappings = new HashMap<>(); - Map> aliases = new HashMap<>(); + Map mappings = new HashMap<>(); + Map> aliases = new HashMap<>(); Map settings = new HashMap<>(); Map defaultSettings = new HashMap<>(); IndexScopedSettings indexScopedSettings = IndexScopedSettings.DEFAULT_SCOPED_SETTINGS; @@ -81,13 +81,13 @@ public class GetIndexResponseTests extends ESTestCase { for (String index: indices) { mappings.put(index, createMappingsForIndex()); - List aliasMetaDataList = new ArrayList<>(); + List aliasMetadataList = new ArrayList<>(); int aliasesNum = randomIntBetween(0, 3); for (int i=0; i> allMappings = ImmutableOpenMap.builder(); - ImmutableOpenMap.Builder> aliases = ImmutableOpenMap.builder(); + ImmutableOpenMap.Builder> allMappings = ImmutableOpenMap.builder(); + ImmutableOpenMap.Builder> aliases = ImmutableOpenMap.builder(); ImmutableOpenMap.Builder settings = ImmutableOpenMap.builder(); ImmutableOpenMap.Builder defaultSettings = ImmutableOpenMap.builder(); - Map indexMappings = response.getMappings(); + Map indexMappings = response.getMappings(); for (String index : response.getIndices()) { - MappingMetaData mmd = indexMappings.get(index); - ImmutableOpenMap.Builder typedMappings = ImmutableOpenMap.builder(); + MappingMetadata mmd = indexMappings.get(index); + ImmutableOpenMap.Builder typedMappings = ImmutableOpenMap.builder(); if (mmd != null) { typedMappings.put(MapperService.SINGLE_MAPPING_NAME, mmd); } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetIndexTemplatesResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetIndexTemplatesResponseTests.java index 361acc23741..62ece236cad 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetIndexTemplatesResponseTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetIndexTemplatesResponseTests.java @@ -19,8 +19,8 @@ package org.elasticsearch.client.indices; -import org.elasticsearch.cluster.metadata.AliasMetaData; -import org.elasticsearch.cluster.metadata.MappingMetaData; +import org.elasticsearch.cluster.metadata.AliasMetadata; +import org.elasticsearch.cluster.metadata.MappingMetadata; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.compress.CompressedXContent; @@ -78,15 +78,15 @@ public class GetIndexTemplatesResponseTests extends ESTestCase { XContentType xContentType = randomFrom(XContentType.values()); int numTemplates = randomIntBetween(0, 32); for (int i = 0; i < numTemplates; i++) { - org.elasticsearch.cluster.metadata.IndexTemplateMetaData.Builder esIMD = - new org.elasticsearch.cluster.metadata.IndexTemplateMetaData.Builder(String.format(Locale.ROOT, "%02d ", i) + + org.elasticsearch.cluster.metadata.IndexTemplateMetadata.Builder esIMD = + new org.elasticsearch.cluster.metadata.IndexTemplateMetadata.Builder(String.format(Locale.ROOT, "%02d ", i) + randomAlphaOfLength(4)); esIMD.patterns(Arrays.asList(generateRandomStringArray(32, 4, false, false))); esIMD.settings(randomIndexSettings()); esIMD.putMapping("_doc", new CompressedXContent(BytesReference.bytes(randomMapping("_doc", xContentType)))); int numAliases = randomIntBetween(0, 8); for (int j = 0; j < numAliases; j++) { - esIMD.putAlias(randomAliasMetaData(String.format(Locale.ROOT, "%02d ", j) + randomAlphaOfLength(4))); + esIMD.putAlias(randomAliasMetadata(String.format(Locale.ROOT, "%02d ", j) + randomAlphaOfLength(4))); } esIMD.order(randomIntBetween(0, Integer.MAX_VALUE)); esIMD.version(randomIntBetween(0, Integer.MAX_VALUE)); @@ -101,10 +101,10 @@ public class GetIndexTemplatesResponseTests extends ESTestCase { GetIndexTemplatesResponse response = GetIndexTemplatesResponse.fromXContent(parser); assertThat(response.getIndexTemplates().size(), equalTo(numTemplates)); - response.getIndexTemplates().sort(Comparator.comparing(IndexTemplateMetaData::name)); + response.getIndexTemplates().sort(Comparator.comparing(IndexTemplateMetadata::name)); for (int i = 0; i < numTemplates; i++) { - org.elasticsearch.cluster.metadata.IndexTemplateMetaData esIMD = esResponse.getIndexTemplates().get(i); - IndexTemplateMetaData result = response.getIndexTemplates().get(i); + org.elasticsearch.cluster.metadata.IndexTemplateMetadata esIMD = esResponse.getIndexTemplates().get(i); + IndexTemplateMetadata result = response.getIndexTemplates().get(i); assertThat(result.patterns(), equalTo(esIMD.patterns())); assertThat(result.settings(), equalTo(esIMD.settings())); @@ -118,11 +118,11 @@ public class GetIndexTemplatesResponseTests extends ESTestCase { assertThat(result.mappings().sourceAsMap(), equalTo(expectedMapping.get("_doc"))); assertThat(result.aliases().size(), equalTo(esIMD.aliases().size())); - List expectedAliases = Arrays.stream(esIMD.aliases().values().toArray(AliasMetaData.class)) - .sorted(Comparator.comparing(AliasMetaData::alias)) + List expectedAliases = Arrays.stream(esIMD.aliases().values().toArray(AliasMetadata.class)) + .sorted(Comparator.comparing(AliasMetadata::alias)) .collect(Collectors.toList()); - List actualAliases = Arrays.stream(result.aliases().values().toArray(AliasMetaData.class)) - .sorted(Comparator.comparing(AliasMetaData::alias)) + List actualAliases = Arrays.stream(result.aliases().values().toArray(AliasMetadata.class)) + .sorted(Comparator.comparing(AliasMetadata::alias)) .collect(Collectors.toList()); for (int j = 0; j < result.aliases().size(); j++) { assertThat(actualAliases.get(j), equalTo(expectedAliases.get(j))); @@ -148,8 +148,8 @@ public class GetIndexTemplatesResponseTests extends ESTestCase { // Check there's no doc types at the root of the mapping Map expectedMap = XContentHelper.convertToMap( new BytesArray(mappingString), true, XContentType.JSON).v2(); - for (IndexTemplateMetaData template : newInstance.getIndexTemplates()) { - MappingMetaData mappingMD = template.mappings(); + for (IndexTemplateMetadata template : newInstance.getIndexTemplates()) { + MappingMetadata mappingMD = template.mappings(); if(mappingMD != null) { Map mappingAsMap = mappingMD.sourceAsMap(); assertEquals(expectedMap, mappingAsMap); @@ -158,14 +158,14 @@ public class GetIndexTemplatesResponseTests extends ESTestCase { } static GetIndexTemplatesResponse createTestInstance() { - List templates = new ArrayList<>(); + List templates = new ArrayList<>(); int numTemplates = between(0, 10); for (int t = 0; t < numTemplates; t++) { - IndexTemplateMetaData.Builder templateBuilder = IndexTemplateMetaData.builder("template-" + t); + IndexTemplateMetadata.Builder templateBuilder = IndexTemplateMetadata.builder("template-" + t); templateBuilder.patterns(IntStream.range(0, between(1, 5)).mapToObj(i -> "pattern-" + i).collect(Collectors.toList())); int numAlias = between(0, 5); for (int i = 0; i < numAlias; i++) { - templateBuilder.putAlias(AliasMetaData.builder(randomAlphaOfLengthBetween(1, 10))); + templateBuilder.putAlias(AliasMetadata.builder(randomAlphaOfLengthBetween(1, 10))); } if (randomBoolean()) { templateBuilder.settings(Settings.builder().put("index.setting-1", randomLong())); @@ -179,7 +179,7 @@ public class GetIndexTemplatesResponseTests extends ESTestCase { if (randomBoolean()) { try { Map map = XContentHelper.convertToMap(new BytesArray(mappingString), true, XContentType.JSON).v2(); - MappingMetaData mapping = new MappingMetaData(MapperService.SINGLE_MAPPING_NAME, map); + MappingMetadata mapping = new MappingMetadata(MapperService.SINGLE_MAPPING_NAME, map); templateBuilder.mapping(mapping); } catch (IOException ex) { throw new UncheckedIOException(ex); @@ -195,15 +195,15 @@ public class GetIndexTemplatesResponseTests extends ESTestCase { //Create a server-side counterpart for the client-side class and call toXContent on it - List serverIndexTemplates = new ArrayList<>(); - List clientIndexTemplates = response.getIndexTemplates(); - for (IndexTemplateMetaData clientITMD : clientIndexTemplates) { - org.elasticsearch.cluster.metadata.IndexTemplateMetaData.Builder serverTemplateBuilder = - org.elasticsearch.cluster.metadata.IndexTemplateMetaData.builder(clientITMD.name()); + List serverIndexTemplates = new ArrayList<>(); + List clientIndexTemplates = response.getIndexTemplates(); + for (IndexTemplateMetadata clientITMD : clientIndexTemplates) { + org.elasticsearch.cluster.metadata.IndexTemplateMetadata.Builder serverTemplateBuilder = + org.elasticsearch.cluster.metadata.IndexTemplateMetadata.builder(clientITMD.name()); serverTemplateBuilder.patterns(clientITMD.patterns()); - Iterator aliases = clientITMD.aliases().valuesIt(); + Iterator aliases = clientITMD.aliases().valuesIt(); aliases.forEachRemaining((a)->serverTemplateBuilder.putAlias(a)); serverTemplateBuilder.settings(clientITMD.settings()); @@ -220,8 +220,8 @@ public class GetIndexTemplatesResponseTests extends ESTestCase { serverResponse.toXContent(builder, ToXContent.EMPTY_PARAMS); } - private static AliasMetaData randomAliasMetaData(String name) { - AliasMetaData.Builder alias = AliasMetaData.builder(name); + private static AliasMetadata randomAliasMetadata(String name) { + AliasMetadata.Builder alias = AliasMetadata.builder(name); if (randomBoolean()) { if (randomBoolean()) { alias.routing(randomAlphaOfLength(5)); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetMappingsResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetMappingsResponseTests.java index 0601609a8a7..bb502cfe9b7 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetMappingsResponseTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetMappingsResponseTests.java @@ -19,7 +19,7 @@ package org.elasticsearch.client.indices; -import org.elasticsearch.cluster.metadata.MappingMetaData; +import org.elasticsearch.cluster.metadata.MappingMetadata; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent.Params; @@ -56,8 +56,8 @@ public class GetMappingsResponseTests extends ESTestCase { } private static GetMappingsResponse createTestInstance() { - Map mappings = Collections.singletonMap( - "index-" + randomAlphaOfLength(5), randomMappingMetaData()); + Map mappings = Collections.singletonMap( + "index-" + randomAlphaOfLength(5), randomMappingMetadata()); return new GetMappingsResponse(mappings); } @@ -69,7 +69,7 @@ public class GetMappingsResponseTests extends ESTestCase { return field -> !field.equals(MAPPINGS.getPreferredName()); } - public static MappingMetaData randomMappingMetaData() { + public static MappingMetadata randomMappingMetadata() { Map mappings = new HashMap<>(); if (frequently()) { // rarely have no fields @@ -80,7 +80,7 @@ public class GetMappingsResponseTests extends ESTestCase { } try { - return new MappingMetaData(MapperService.SINGLE_MAPPING_NAME, mappings); + return new MappingMetadata(MapperService.SINGLE_MAPPING_NAME, mappings); } catch (IOException e) { throw new RuntimeException(e); } @@ -102,10 +102,10 @@ public class GetMappingsResponseTests extends ESTestCase { private static void toXContent(GetMappingsResponse response, XContentBuilder builder) throws IOException { Params params = new ToXContent.MapParams( Collections.singletonMap(BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER, "false")); - ImmutableOpenMap.Builder> allMappings = ImmutableOpenMap.builder(); + ImmutableOpenMap.Builder> allMappings = ImmutableOpenMap.builder(); - for (Map.Entry indexEntry : response.mappings().entrySet()) { - ImmutableOpenMap.Builder mappings = ImmutableOpenMap.builder(); + for (Map.Entry indexEntry : response.mappings().entrySet()) { + ImmutableOpenMap.Builder mappings = ImmutableOpenMap.builder(); mappings.put(MapperService.SINGLE_MAPPING_NAME, indexEntry.getValue()); allMappings.put(indexEntry.getKey(), mappings.build()); } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/rollup/GetRollupCapsRequestTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/rollup/GetRollupCapsRequestTests.java index bca08f7bfc5..fa7ef75202a 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/rollup/GetRollupCapsRequestTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/rollup/GetRollupCapsRequestTests.java @@ -18,7 +18,7 @@ */ package org.elasticsearch.client.rollup; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.test.ESTestCase; import static org.hamcrest.Matchers.equalTo; @@ -26,8 +26,8 @@ import static org.hamcrest.Matchers.equalTo; public class GetRollupCapsRequestTests extends ESTestCase { public void testImplicitIndexPattern() { - String pattern = randomFrom("", "*", MetaData.ALL, null); + String pattern = randomFrom("", "*", Metadata.ALL, null); GetRollupCapsRequest request = new GetRollupCapsRequest(pattern); - assertThat(request.getIndexPattern(), equalTo(MetaData.ALL)); + assertThat(request.getIndexPattern(), equalTo(Metadata.ALL)); } } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/watcher/WatcherStatsResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/watcher/WatcherStatsResponseTests.java index f1efe13c761..ceb53920af5 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/watcher/WatcherStatsResponseTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/watcher/WatcherStatsResponseTests.java @@ -52,7 +52,7 @@ public class WatcherStatsResponseTests extends ESTestCase { private void toXContent(WatcherStatsResponse response, XContentBuilder builder) throws IOException { builder.startObject(); NodesResponseHeaderTestUtils.toXContent(response.getHeader(), response.getClusterName(), builder); - toXContent(response.getWatcherMetaData(), builder); + toXContent(response.getWatcherMetadata(), builder); builder.startArray("stats"); for (WatcherStatsResponse.Node node : response.getNodes()) { toXContent(node, builder); @@ -61,8 +61,8 @@ public class WatcherStatsResponseTests extends ESTestCase { builder.endObject(); } - private void toXContent(WatcherMetaData metaData, XContentBuilder builder) throws IOException { - builder.field("manually_stopped", metaData.manuallyStopped()); + private void toXContent(WatcherMetadata metadata, XContentBuilder builder) throws IOException { + builder.field("manually_stopped", metadata.manuallyStopped()); } private void toXContent(WatcherStatsResponse.Node node, XContentBuilder builder) throws IOException { @@ -182,7 +182,7 @@ public class WatcherStatsResponseTests extends ESTestCase { } NodesResponseHeader nodesResponseHeader = new NodesResponseHeader(randomInt(10), randomInt(10), randomInt(10), Collections.emptyList()); - WatcherMetaData watcherMetaData = new WatcherMetaData(randomBoolean()); - return new WatcherStatsResponse(nodesResponseHeader, randomAlphaOfLength(10), watcherMetaData, nodes); + WatcherMetadata watcherMetadata = new WatcherMetadata(randomBoolean()); + return new WatcherStatsResponse(nodesResponseHeader, randomAlphaOfLength(10), watcherMetadata, nodes); } } diff --git a/docs/reference/ml/anomaly-detection/apis/find-file-structure.asciidoc b/docs/reference/ml/anomaly-detection/apis/find-file-structure.asciidoc index f5173ab504e..44ef45d9a0b 100644 --- a/docs/reference/ml/anomaly-detection/apis/find-file-structure.asciidoc +++ b/docs/reference/ml/anomaly-detection/apis/find-file-structure.asciidoc @@ -1766,7 +1766,7 @@ this: "count" : 26 }, { - "value" : "o.e.c.m.MetaDataIndexTemplateService", + "value" : "o.e.c.m.MetadataIndexTemplateService", "count" : 8 }, { diff --git a/docs/reference/release-notes/7.0.0-alpha2.asciidoc b/docs/reference/release-notes/7.0.0-alpha2.asciidoc index b07088d6cfe..3cb5713c16c 100644 --- a/docs/reference/release-notes/7.0.0-alpha2.asciidoc +++ b/docs/reference/release-notes/7.0.0-alpha2.asciidoc @@ -185,7 +185,7 @@ CRUD:: Distributed:: * [Close Index API] Mark shard copy as stale if needed during shard verification {pull}36755[#36755] -* [Close Index API] Refactor MetaDataIndexStateService {pull}36354[#36354] (issue: {issue}36249[#36249]) +* [Close Index API] Refactor MetadataIndexStateService {pull}36354[#36354] (issue: {issue}36249[#36249]) * [Close Index API] Add TransportShardCloseAction for pre-closing verifications {pull}36249[#36249] * TransportResyncReplicationAction should not honour blocks {pull}35795[#35795] (issues: {issue}35332[#35332], {issue}35597[#35597]) * Expose all permits acquisition in IndexShard and TransportReplicationAction {pull}35540[#35540] (issue: {issue}33888[#33888]) @@ -399,7 +399,7 @@ ZenDiscovery:: * [Zen2] PersistedState interface implementation {pull}35819[#35819] * [Zen2] Support rolling upgrades from Zen1 {pull}35737[#35737] * [Zen2] Add lag detector {pull}35685[#35685] -* [Zen2] Move ClusterState fields to be persisted to ClusterState.MetaData {pull}35625[#35625] +* [Zen2] Move ClusterState fields to be persisted to ClusterState.Metadata {pull}35625[#35625] * [Zen2] Introduce ClusterBootstrapService {pull}35488[#35488] * [Zen2] Introduce vote withdrawal {pull}35446[#35446] * Zen2: Add basic Zen1 transport-level BWC {pull}35443[#35443] diff --git a/docs/reference/release-notes/7.0.0-beta1.asciidoc b/docs/reference/release-notes/7.0.0-beta1.asciidoc index cf3e9c7121d..21a940633b2 100644 --- a/docs/reference/release-notes/7.0.0-beta1.asciidoc +++ b/docs/reference/release-notes/7.0.0-beta1.asciidoc @@ -514,7 +514,7 @@ Features/Ingest:: * ingest: support default pipelines + bulk upserts {pull}36618[#36618] (issue: {issue}36219[#36219]) Features/Java High Level REST Client:: -* Update IndexTemplateMetaData to allow unknown fields {pull}38448[#38448] (issue: {issue}36938[#36938]) +* Update IndexTemplateMetadata to allow unknown fields {pull}38448[#38448] (issue: {issue}36938[#36938]) * `if_seq_no` and `if_primary_term` parameters aren't wired correctly in REST Client's CRUD API {pull}38411[#38411] * Update Rollup Caps to allow unknown fields {pull}38339[#38339] (issue: {issue}36938[#36938]) * Fix ILM explain response to allow unknown fields {pull}38054[#38054] (issue: {issue}36938[#36938]) diff --git a/docs/reference/release-notes/7.0.asciidoc b/docs/reference/release-notes/7.0.asciidoc index 2dffe3da4f5..44ec8f91504 100644 --- a/docs/reference/release-notes/7.0.asciidoc +++ b/docs/reference/release-notes/7.0.asciidoc @@ -571,7 +571,7 @@ Discovery-Plugins:: Distributed:: * [Close Index API] Mark shard copy as stale if needed during shard verification {pull}36755[#36755] -* [Close Index API] Refactor MetaDataIndexStateService {pull}36354[#36354] (issue: {issue}36249[#36249]) +* [Close Index API] Refactor MetadataIndexStateService {pull}36354[#36354] (issue: {issue}36249[#36249]) * [Close Index API] Add TransportShardCloseAction for pre-closing verifications {pull}36249[#36249] * TransportResyncReplicationAction should not honour blocks {pull}35795[#35795] (issues: {issue}35332[#35332], {issue}35597[#35597]) * Expose all permits acquisition in IndexShard and TransportReplicationAction {pull}35540[#35540] (issue: {issue}33888[#33888]) @@ -1076,7 +1076,7 @@ ZenDiscovery:: * PersistedState interface implementation {pull}35819[#35819] * Support rolling upgrades from Zen1 {pull}35737[#35737] * Add lag detector {pull}35685[#35685] -* Move ClusterState fields to be persisted to ClusterState.MetaData {pull}35625[#35625] +* Move ClusterState fields to be persisted to ClusterState.Metadata {pull}35625[#35625] * Introduce ClusterBootstrapService {pull}35488[#35488] * Introduce vote withdrawal {pull}35446[#35446] * Add basic Zen1 transport-level BWC {pull}35443[#35443] @@ -1251,7 +1251,7 @@ Features/Ingest:: Features/Java High Level REST Client:: * Drop extra level from user parser {pull}34932[#34932] -* Update IndexTemplateMetaData to allow unknown fields {pull}38448[#38448] (issue: {issue}36938[#36938]) +* Update IndexTemplateMetadata to allow unknown fields {pull}38448[#38448] (issue: {issue}36938[#36938]) * `if_seq_no` and `if_primary_term` parameters aren't wired correctly in REST Client's CRUD API {pull}38411[#38411] * Update Rollup Caps to allow unknown fields {pull}38339[#38339] (issue: {issue}36938[#36938]) * Fix ILM explain response to allow unknown fields {pull}38054[#38054] (issue: {issue}36938[#36938]) diff --git a/docs/reference/release-notes/7.3.asciidoc b/docs/reference/release-notes/7.3.asciidoc index 0e7452202fe..105fdd3cc38 100644 --- a/docs/reference/release-notes/7.3.asciidoc +++ b/docs/reference/release-notes/7.3.asciidoc @@ -285,7 +285,7 @@ Engine:: * Add a merge policy that prunes ID postings for soft-deleted but retained documents {pull}40741[#40741] Features/Indices APIs:: -* Remove "template" field in IndexTemplateMetaData {pull}42099[#42099] (issue: {issue}38502[#38502]) +* Remove "template" field in IndexTemplateMetadata {pull}42099[#42099] (issue: {issue}38502[#38502]) Features/Ingest:: * Avoid HashMap construction on Grok non-match {pull}42444[#42444] diff --git a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStats.java b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStats.java index 5fda5af7418..0e5b7a01658 100644 --- a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStats.java +++ b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStats.java @@ -43,8 +43,8 @@ public class InternalMatrixStats extends InternalAggregation implements MatrixSt /** per shard ctor */ InternalMatrixStats(String name, long count, RunningStats multiFieldStatsResults, MatrixStatsResults results, - List pipelineAggregators, Map metaData) { - super(name, pipelineAggregators, metaData); + List pipelineAggregators, Map metadata) { + super(name, pipelineAggregators, metadata); assert count >= 0; this.stats = multiFieldStatsResults; this.results = results; @@ -240,7 +240,7 @@ public class InternalMatrixStats extends InternalAggregation implements MatrixSt // return empty result iff all stats are null if (aggs.isEmpty()) { - return new InternalMatrixStats(name, 0, null, new MatrixStatsResults(), pipelineAggregators(), getMetaData()); + return new InternalMatrixStats(name, 0, null, new MatrixStatsResults(), pipelineAggregators(), getMetadata()); } RunningStats runningStats = new RunningStats(); @@ -250,9 +250,9 @@ public class InternalMatrixStats extends InternalAggregation implements MatrixSt if (reduceContext.isFinalReduce()) { MatrixStatsResults results = new MatrixStatsResults(runningStats); - return new InternalMatrixStats(name, results.getDocCount(), runningStats, results, pipelineAggregators(), getMetaData()); + return new InternalMatrixStats(name, results.getDocCount(), runningStats, results, pipelineAggregators(), getMetadata()); } - return new InternalMatrixStats(name, runningStats.docCount, runningStats, null, pipelineAggregators(), getMetaData()); + return new InternalMatrixStats(name, runningStats.docCount, runningStats, null, pipelineAggregators(), getMetadata()); } @Override diff --git a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregationBuilder.java b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregationBuilder.java index 46d0412deee..43267a249c4 100644 --- a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregationBuilder.java +++ b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregationBuilder.java @@ -48,14 +48,14 @@ public class MatrixStatsAggregationBuilder } protected MatrixStatsAggregationBuilder(MatrixStatsAggregationBuilder clone, - AggregatorFactories.Builder factoriesBuilder, Map metaData) { - super(clone, factoriesBuilder, metaData); + AggregatorFactories.Builder factoriesBuilder, Map metadata) { + super(clone, factoriesBuilder, metadata); this.multiValueMode = clone.multiValueMode; } @Override - protected AggregationBuilder shallowCopy(AggregatorFactories.Builder factoriesBuilder, Map metaData) { - return new MatrixStatsAggregationBuilder(this, factoriesBuilder, metaData); + protected AggregationBuilder shallowCopy(AggregatorFactories.Builder factoriesBuilder, Map metadata) { + return new MatrixStatsAggregationBuilder(this, factoriesBuilder, metadata); } /** @@ -84,7 +84,7 @@ public class MatrixStatsAggregationBuilder Map> configs, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder) throws IOException { - return new MatrixStatsAggregatorFactory(name, configs, multiValueMode, queryShardContext, parent, subFactoriesBuilder, metaData); + return new MatrixStatsAggregatorFactory(name, configs, multiValueMode, queryShardContext, parent, subFactoriesBuilder, metadata); } @Override diff --git a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregator.java b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregator.java index 82104818c5f..ed121465b62 100644 --- a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregator.java +++ b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregator.java @@ -51,8 +51,8 @@ final class MatrixStatsAggregator extends MetricsAggregator { MatrixStatsAggregator(String name, Map valuesSources, SearchContext context, Aggregator parent, MultiValueMode multiValueMode, List pipelineAggregators, - Map metaData) throws IOException { - super(name, context, parent, pipelineAggregators, metaData); + Map metadata) throws IOException { + super(name, context, parent, pipelineAggregators, metadata); if (valuesSources != null && !valuesSources.isEmpty()) { this.valuesSources = new NumericArrayValuesSource(valuesSources, multiValueMode); stats = context.bigArrays().newObjectArray(1); @@ -126,12 +126,12 @@ final class MatrixStatsAggregator extends MetricsAggregator { if (valuesSources == null || bucket >= stats.size()) { return buildEmptyAggregation(); } - return new InternalMatrixStats(name, stats.size(), stats.get(bucket), null, pipelineAggregators(), metaData()); + return new InternalMatrixStats(name, stats.size(), stats.get(bucket), null, pipelineAggregators(), metadata()); } @Override public InternalAggregation buildEmptyAggregation() { - return new InternalMatrixStats(name, 0, null, null, pipelineAggregators(), metaData()); + return new InternalMatrixStats(name, 0, null, null, pipelineAggregators(), metadata()); } @Override diff --git a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregatorFactory.java b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregatorFactory.java index edd5f20d009..57e199eb34f 100644 --- a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregatorFactory.java +++ b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregatorFactory.java @@ -43,8 +43,8 @@ final class MatrixStatsAggregatorFactory extends ArrayValuesSourceAggregatorFact QueryShardContext queryShardContext, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, - Map metaData) throws IOException { - super(name, configs, queryShardContext, parent, subFactoriesBuilder, metaData); + Map metadata) throws IOException { + super(name, configs, queryShardContext, parent, subFactoriesBuilder, metadata); this.multiValueMode = multiValueMode; } @@ -52,9 +52,9 @@ final class MatrixStatsAggregatorFactory extends ArrayValuesSourceAggregatorFact protected Aggregator createUnmapped(SearchContext searchContext, Aggregator parent, List pipelineAggregators, - Map metaData) + Map metadata) throws IOException { - return new MatrixStatsAggregator(name, null, searchContext, parent, multiValueMode, pipelineAggregators, metaData); + return new MatrixStatsAggregator(name, null, searchContext, parent, multiValueMode, pipelineAggregators, metadata); } @Override @@ -63,7 +63,7 @@ final class MatrixStatsAggregatorFactory extends ArrayValuesSourceAggregatorFact Aggregator parent, boolean collectsFromSingleBucket, List pipelineAggregators, - Map metaData) throws IOException { - return new MatrixStatsAggregator(name, valuesSources, searchContext, parent, multiValueMode, pipelineAggregators, metaData); + Map metadata) throws IOException { + return new MatrixStatsAggregator(name, valuesSources, searchContext, parent, multiValueMode, pipelineAggregators, metadata); } } diff --git a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceAggregationBuilder.java b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceAggregationBuilder.java index eb90e2b3690..2017ae15ce4 100644 --- a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceAggregationBuilder.java +++ b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceAggregationBuilder.java @@ -56,8 +56,8 @@ public abstract class ArrayValuesSourceAggregationBuilder clone, Builder factoriesBuilder, Map metaData) { - super(clone, factoriesBuilder, metaData); + protected LeafOnly(LeafOnly clone, Builder factoriesBuilder, Map metadata) { + super(clone, factoriesBuilder, metadata); if (factoriesBuilder.count() > 0) { throw new AggregationInitializationException("Aggregator [" + name + "] of type [" + getType() + "] cannot accept sub-aggregations"); @@ -109,8 +109,8 @@ public abstract class ArrayValuesSourceAggregationBuilder clone, - Builder factoriesBuilder, Map metaData) { - super(clone, factoriesBuilder, metaData); + Builder factoriesBuilder, Map metadata) { + super(clone, factoriesBuilder, metadata); this.valuesSourceType = clone.valuesSourceType; this.targetValueType = clone.targetValueType; this.fields = new ArrayList<>(clone.fields); diff --git a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceAggregatorFactory.java b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceAggregatorFactory.java index a21c4dbd366..5201513bf99 100644 --- a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceAggregatorFactory.java +++ b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceAggregatorFactory.java @@ -39,8 +39,8 @@ public abstract class ArrayValuesSourceAggregatorFactory> configs, QueryShardContext queryShardContext, AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, - Map metaData) throws IOException { - super(name, queryShardContext, parent, subFactoriesBuilder, metaData); + Map metadata) throws IOException { + super(name, queryShardContext, parent, subFactoriesBuilder, metadata); this.configs = configs; } @@ -49,7 +49,7 @@ public abstract class ArrayValuesSourceAggregatorFactory pipelineAggregators, - Map metaData) throws IOException { + Map metadata) throws IOException { HashMap valuesSources = new HashMap<>(); for (Map.Entry> config : configs.entrySet()) { @@ -59,22 +59,22 @@ public abstract class ArrayValuesSourceAggregatorFactory pipelineAggregators, - Map metaData) throws IOException; + Map metadata) throws IOException; protected abstract Aggregator doCreateInternal(Map valuesSources, SearchContext searchContext, Aggregator parent, boolean collectsFromSingleBucket, List pipelineAggregators, - Map metaData) throws IOException; + Map metadata) throws IOException; } diff --git a/modules/aggs-matrix-stats/src/test/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStatsTests.java b/modules/aggs-matrix-stats/src/test/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStatsTests.java index 2d0997df268..c4044219bb0 100644 --- a/modules/aggs-matrix-stats/src/test/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStatsTests.java +++ b/modules/aggs-matrix-stats/src/test/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStatsTests.java @@ -70,7 +70,7 @@ public class InternalMatrixStatsTests extends InternalAggregationTestCase pipelineAggregators, - Map metaData) { + Map metadata) { double[] values = new double[fields.length]; for (int i = 0; i < fields.length; i++) { values[i] = randomDouble(); @@ -79,7 +79,7 @@ public class InternalMatrixStatsTests extends InternalAggregationTestCase metaData = instance.getMetaData(); + Map metadata = instance.getMetadata(); switch (between(0, 3)) { case 0: name += randomAlphaOfLength(5); @@ -117,15 +117,15 @@ public class InternalMatrixStatsTests extends InternalAggregationTestCase(1); + if (metadata == null) { + metadata = new HashMap<>(1); } else { - metaData = new HashMap<>(instance.getMetaData()); + metadata = new HashMap<>(instance.getMetadata()); } - metaData.put(randomAlphaOfLength(15), randomInt()); + metadata.put(randomAlphaOfLength(15), randomInt()); break; } - return new InternalMatrixStats(name, docCount, runningStats, matrixStatsResults, Collections.emptyList(), metaData); + return new InternalMatrixStats(name, docCount, runningStats, matrixStatsResults, Collections.emptyList(), metadata); } @Override diff --git a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/CommonAnalysisPluginTests.java b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/CommonAnalysisPluginTests.java index 1cafceea197..d8283aab6d2 100644 --- a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/CommonAnalysisPluginTests.java +++ b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/CommonAnalysisPluginTests.java @@ -22,7 +22,7 @@ package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.Tokenizer; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; @@ -43,7 +43,7 @@ public class CommonAnalysisPluginTests extends ESTestCase { */ public void testNGramDeprecationWarning() throws IOException { Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) - .put(IndexMetaData.SETTING_VERSION_CREATED, + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_0_0))) .put("index.analysis.analyzer.custom_analyzer.type", "custom") .put("index.analysis.analyzer.custom_analyzer.tokenizer", "standard") @@ -63,7 +63,7 @@ public class CommonAnalysisPluginTests extends ESTestCase { */ public void testNGramDeprecationError() throws IOException { Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) - .put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_7_0_0, null)) + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_7_0_0, null)) .put("index.analysis.analyzer.custom_analyzer.type", "custom") .put("index.analysis.analyzer.custom_analyzer.tokenizer", "standard") .putList("index.analysis.analyzer.custom_analyzer.filter", "nGram") @@ -82,7 +82,7 @@ public class CommonAnalysisPluginTests extends ESTestCase { */ public void testEdgeNGramDeprecationWarning() throws IOException { Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) - .put(IndexMetaData.SETTING_VERSION_CREATED, + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_6_4_0, VersionUtils.getPreviousVersion(Version.V_7_0_0))) .put("index.analysis.analyzer.custom_analyzer.type", "custom") .put("index.analysis.analyzer.custom_analyzer.tokenizer", "standard") @@ -101,7 +101,7 @@ public class CommonAnalysisPluginTests extends ESTestCase { */ public void testEdgeNGramDeprecationError() throws IOException { Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) - .put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_7_0_0, null)) + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_7_0_0, null)) .put("index.analysis.analyzer.custom_analyzer.type", "custom") .put("index.analysis.analyzer.custom_analyzer.tokenizer", "standard") .putList("index.analysis.analyzer.custom_analyzer.filter", "edgeNGram") @@ -120,7 +120,7 @@ public class CommonAnalysisPluginTests extends ESTestCase { */ public void testStandardHtmlStripAnalyzerDeprecationError() throws IOException { Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) - .put(IndexMetaData.SETTING_VERSION_CREATED, + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_7_0_0, Version.CURRENT)) .put("index.analysis.analyzer.custom_analyzer.type", "standard_html_strip") .putList("index.analysis.analyzer.custom_analyzer.stopwords", "a", "b") @@ -139,7 +139,7 @@ public class CommonAnalysisPluginTests extends ESTestCase { */ public void testStandardHtmlStripAnalyzerDeprecationWarning() throws IOException { Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) - .put(IndexMetaData.SETTING_VERSION_CREATED, + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_0_0))) .put("index.analysis.analyzer.custom_analyzer.type", "standard_html_strip") @@ -162,7 +162,7 @@ public class CommonAnalysisPluginTests extends ESTestCase { */ public void testnGramFilterInCustomAnalyzerDeprecationError() throws IOException { final Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) - .put(IndexMetaData.SETTING_VERSION_CREATED, + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_7_0_0, Version.CURRENT)) .put("index.analysis.analyzer.custom_analyzer.type", "custom") .put("index.analysis.analyzer.custom_analyzer.tokenizer", "standard") @@ -182,7 +182,7 @@ public class CommonAnalysisPluginTests extends ESTestCase { */ public void testEdgeNGramFilterInCustomAnalyzerDeprecationError() throws IOException { final Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) - .put(IndexMetaData.SETTING_VERSION_CREATED, + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_7_0_0, Version.CURRENT)) .put("index.analysis.analyzer.custom_analyzer.type", "custom") .put("index.analysis.analyzer.custom_analyzer.tokenizer", "standard") @@ -221,7 +221,7 @@ public class CommonAnalysisPluginTests extends ESTestCase { public void doTestPrebuiltTokenizerDeprecation(String deprecatedName, String replacement, Version version, boolean expectWarning) throws IOException { final Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) - .put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + .put(IndexMetadata.SETTING_VERSION_CREATED, version).build(); try (CommonAnalysisPlugin commonAnalysisPlugin = new CommonAnalysisPlugin()) { Map tokenizers = createTestAnalysis( @@ -240,7 +240,7 @@ public class CommonAnalysisPluginTests extends ESTestCase { public void doTestCustomTokenizerDeprecation(String deprecatedName, String replacement, Version version, boolean expectWarning) throws IOException { final Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) - .put(IndexMetaData.SETTING_VERSION_CREATED, version) + .put(IndexMetadata.SETTING_VERSION_CREATED, version) .put("index.analysis.analyzer.custom_analyzer.type", "custom") .put("index.analysis.analyzer.custom_analyzer.tokenizer", "my_tokenizer") .put("index.analysis.tokenizer.my_tokenizer.type", deprecatedName) diff --git a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/CompoundAnalysisTests.java b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/CompoundAnalysisTests.java index 9a7bf5eb915..d50e5d8bd5b 100644 --- a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/CompoundAnalysisTests.java +++ b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/CompoundAnalysisTests.java @@ -23,7 +23,7 @@ import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.env.TestEnvironment; @@ -100,7 +100,7 @@ public class CompoundAnalysisTests extends ESTestCase { String json = "/org/elasticsearch/analysis/common/test1.json"; return Settings.builder() .loadFromStream(json, getClass().getResourceAsStream(json), false) - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .build(); } @@ -109,7 +109,7 @@ public class CompoundAnalysisTests extends ESTestCase { String yaml = "/org/elasticsearch/analysis/common/test1.yml"; return Settings.builder() .loadFromStream(yaml, getClass().getResourceAsStream(yaml), false) - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .build(); } diff --git a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/EdgeNGramTokenizerTests.java b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/EdgeNGramTokenizerTests.java index 5d51a8c27b5..db9196547b6 100644 --- a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/EdgeNGramTokenizerTests.java +++ b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/EdgeNGramTokenizerTests.java @@ -21,7 +21,7 @@ package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.Tokenizer; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.env.TestEnvironment; @@ -45,7 +45,7 @@ public class EdgeNGramTokenizerTests extends ESTokenStreamTestCase { .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .build(); Settings indexSettings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, version) + .put(IndexMetadata.SETTING_VERSION_CREATED, version) .put("index.analysis.analyzer.my_analyzer.tokenizer", tokenizer) .build(); IndexSettings idxSettings = IndexSettingsModule.newIndexSettings("index", indexSettings); diff --git a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/HtmlStripCharFilterFactoryTests.java b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/HtmlStripCharFilterFactoryTests.java index e2848779788..a205279b47d 100644 --- a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/HtmlStripCharFilterFactoryTests.java +++ b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/HtmlStripCharFilterFactoryTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.analysis.common; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; @@ -41,7 +41,7 @@ public class HtmlStripCharFilterFactoryTests extends ESTestCase { */ public void testDeprecationWarning() throws IOException { Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) - .put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_6_3_0, Version.CURRENT)) + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_6_3_0, Version.CURRENT)) .build(); IndexSettings idxSettings = IndexSettingsModule.newIndexSettings("index", settings); @@ -59,7 +59,7 @@ public class HtmlStripCharFilterFactoryTests extends ESTestCase { */ public void testNoDeprecationWarningPre6_3() throws IOException { Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) - .put(IndexMetaData.SETTING_VERSION_CREATED, + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, Version.V_6_2_4)) .build(); diff --git a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/MultiplexerTokenFilterTests.java b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/MultiplexerTokenFilterTests.java index c39fa05c26f..a9663c029a0 100644 --- a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/MultiplexerTokenFilterTests.java +++ b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/MultiplexerTokenFilterTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.analysis.common; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.env.TestEnvironment; @@ -41,7 +41,7 @@ public class MultiplexerTokenFilterTests extends ESTokenStreamTestCase { .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .build(); Settings indexSettings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put("index.analysis.filter.t.type", "truncate") .put("index.analysis.filter.t.length", "2") .put("index.analysis.filter.multiplexFilter.type", "multiplexer") @@ -77,7 +77,7 @@ public class MultiplexerTokenFilterTests extends ESTokenStreamTestCase { .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .build(); Settings indexSettings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put("index.analysis.filter.t.type", "truncate") .put("index.analysis.filter.t.length", "2") .put("index.analysis.filter.multiplexFilter.type", "multiplexer") diff --git a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/NGramTokenizerFactoryTests.java b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/NGramTokenizerFactoryTests.java index b18afbf6ae3..f35269712b3 100644 --- a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/NGramTokenizerFactoryTests.java +++ b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/NGramTokenizerFactoryTests.java @@ -25,7 +25,7 @@ import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.ngram.EdgeNGramTokenFilter; import org.apache.lucene.analysis.reverse.ReverseStringFilter; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings.Builder; import org.elasticsearch.index.Index; @@ -154,7 +154,7 @@ public class NGramTokenizerFactoryTests extends ESTokenStreamTestCase { builder.put("side", "back"); } Settings settings = builder.build(); - Settings indexSettings = newAnalysisSettingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, v.id).build(); + Settings indexSettings = newAnalysisSettingsBuilder().put(IndexMetadata.SETTING_VERSION_CREATED, v.id).build(); Tokenizer tokenizer = new MockTokenizer(); tokenizer.setReader(new StringReader("foo bar")); TokenStream edgeNGramTokenFilter = diff --git a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/PatternCaptureTokenFilterTests.java b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/PatternCaptureTokenFilterTests.java index 57b5a5a0abb..4aa1f95ec26 100644 --- a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/PatternCaptureTokenFilterTests.java +++ b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/PatternCaptureTokenFilterTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.analysis.common; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; @@ -38,7 +38,7 @@ public class PatternCaptureTokenFilterTests extends ESTokenStreamTestCase { Settings settings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) .loadFromStream(json, getClass().getResourceAsStream(json), false) - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .build(); IndexSettings idxSettings = IndexSettingsModule.newIndexSettings("index", settings); diff --git a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/PredicateTokenScriptFilterTests.java b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/PredicateTokenScriptFilterTests.java index 8ea80eade8c..91b33f7553e 100644 --- a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/PredicateTokenScriptFilterTests.java +++ b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/PredicateTokenScriptFilterTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.analysis.common; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.env.TestEnvironment; @@ -44,7 +44,7 @@ public class PredicateTokenScriptFilterTests extends ESTokenStreamTestCase { .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .build(); Settings indexSettings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put("index.analysis.filter.f.type", "predicate_token_filter") .put("index.analysis.filter.f.script.source", "my_script") .put("index.analysis.analyzer.myAnalyzer.type", "custom") diff --git a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/ScriptedConditionTokenFilterTests.java b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/ScriptedConditionTokenFilterTests.java index 5150dd0e295..823c30cd30c 100644 --- a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/ScriptedConditionTokenFilterTests.java +++ b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/ScriptedConditionTokenFilterTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.analysis.common; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.env.TestEnvironment; @@ -43,7 +43,7 @@ public class ScriptedConditionTokenFilterTests extends ESTokenStreamTestCase { .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .build(); Settings indexSettings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put("index.analysis.filter.cond.type", "condition") .put("index.analysis.filter.cond.script.source", "token.getPosition() > 1") .putList("index.analysis.filter.cond.filter", "uppercase") diff --git a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/StemmerTokenFilterFactoryTests.java b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/StemmerTokenFilterFactoryTests.java index 8e3e862f462..e91bc372e30 100644 --- a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/StemmerTokenFilterFactoryTests.java +++ b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/StemmerTokenFilterFactoryTests.java @@ -38,7 +38,7 @@ import java.io.IOException; import java.io.StringReader; import static com.carrotsearch.randomizedtesting.RandomizedTest.scaledRandomIntBetween; -import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_VERSION_CREATED; +import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_VERSION_CREATED; import static org.hamcrest.Matchers.instanceOf; public class StemmerTokenFilterFactoryTests extends ESTokenStreamTestCase { diff --git a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/SynonymsAnalysisTests.java b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/SynonymsAnalysisTests.java index 6582188f33c..aac0508b578 100644 --- a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/SynonymsAnalysisTests.java +++ b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/SynonymsAnalysisTests.java @@ -25,7 +25,7 @@ import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.core.KeywordTokenizer; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; @@ -69,7 +69,7 @@ public class SynonymsAnalysisTests extends ESTestCase { Settings settings = Settings.builder(). loadFromStream(json, getClass().getResourceAsStream(json), false) .put(Environment.PATH_HOME_SETTING.getKey(), home) - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT).build(); IndexSettings idxSettings = IndexSettingsModule.newIndexSettings("index", settings); indexAnalyzers = createTestAnalysis(idxSettings, settings, new CommonAnalysisPlugin()).indexAnalyzers; @@ -89,7 +89,7 @@ public class SynonymsAnalysisTests extends ESTestCase { public void testSynonymWordDeleteByAnalyzer() throws IOException { Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put("path.home", createTempDir().toString()) .put("index.analysis.filter.synonym.type", "synonym") .putList("index.analysis.filter.synonym.synonyms", "kimchy => shay", "dude => elasticsearch", "abides => man!") @@ -110,7 +110,7 @@ public class SynonymsAnalysisTests extends ESTestCase { public void testExpandSynonymWordDeleteByAnalyzer() throws IOException { Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put("path.home", createTempDir().toString()) .put("index.analysis.filter.synonym_expand.type", "synonym") .putList("index.analysis.filter.synonym_expand.synonyms", "kimchy, shay", "dude, elasticsearch", "abides, man!") @@ -131,7 +131,7 @@ public class SynonymsAnalysisTests extends ESTestCase { public void testSynonymsWrappedByMultiplexer() throws IOException { Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put("path.home", createTempDir().toString()) .put("index.analysis.filter.synonyms.type", "synonym") .putList("index.analysis.filter.synonyms.synonyms", "programmer, developer") @@ -152,7 +152,7 @@ public class SynonymsAnalysisTests extends ESTestCase { public void testAsciiFoldingFilterForSynonyms() throws IOException { Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put("path.home", createTempDir().toString()) .put("index.analysis.filter.synonyms.type", "synonym") .putList("index.analysis.filter.synonyms.synonyms", "hoj, height") @@ -169,7 +169,7 @@ public class SynonymsAnalysisTests extends ESTestCase { public void testPreconfigured() throws IOException { Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put("path.home", createTempDir().toString()) .put("index.analysis.filter.synonyms.type", "synonym") .putList("index.analysis.filter.synonyms.synonyms", "würst, sausage") @@ -186,7 +186,7 @@ public class SynonymsAnalysisTests extends ESTestCase { public void testChainedSynonymFilters() throws IOException { Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put("path.home", createTempDir().toString()) .put("index.analysis.filter.synonyms1.type", "synonym") .putList("index.analysis.filter.synonyms1.synonyms", "term1, term2") @@ -205,7 +205,7 @@ public class SynonymsAnalysisTests extends ESTestCase { public void testShingleFilters() { Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_7_0_0, Version.CURRENT)) .put("path.home", createTempDir().toString()) .put("index.analysis.filter.synonyms.type", "synonym") @@ -225,7 +225,7 @@ public class SynonymsAnalysisTests extends ESTestCase { public void testTokenFiltersBypassSynonymAnalysis() throws IOException { Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put("path.home", createTempDir().toString()) .putList("word_list", "a") .put("hyphenation_patterns_path", "foo") @@ -257,7 +257,7 @@ public class SynonymsAnalysisTests extends ESTestCase { )); Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_7_0_0, Version.CURRENT)) .put("path.home", createTempDir().toString()) .build(); @@ -281,7 +281,7 @@ public class SynonymsAnalysisTests extends ESTestCase { } Settings settings2 = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_0_0))) .put("path.home", createTempDir().toString()) .putList("common_words", "a", "b") @@ -305,7 +305,7 @@ public class SynonymsAnalysisTests extends ESTestCase { public void testDisallowedTokenFilters() throws IOException { Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_7_0_0, Version.CURRENT)) .put("path.home", createTempDir().toString()) .putList("common_words", "a", "b") @@ -334,7 +334,7 @@ public class SynonymsAnalysisTests extends ESTestCase { } settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_0_0))) .put("path.home", createTempDir().toString()) .putList("common_words", "a", "b") @@ -356,7 +356,7 @@ public class SynonymsAnalysisTests extends ESTestCase { assertWarnings(expectedWarnings.toArray(new String[0])); settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_0_0))) .put("path.home", createTempDir().toString()) .put("preserve_original", "false") diff --git a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/WhitespaceTokenizerFactoryTests.java b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/WhitespaceTokenizerFactoryTests.java index f34b694fbf6..55211a3076c 100644 --- a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/WhitespaceTokenizerFactoryTests.java +++ b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/WhitespaceTokenizerFactoryTests.java @@ -23,7 +23,7 @@ import com.carrotsearch.randomizedtesting.generators.RandomStrings; import org.apache.lucene.analysis.core.WhitespaceTokenizer; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexSettings; @@ -39,7 +39,7 @@ import static org.apache.lucene.analysis.BaseTokenStreamTestCase.assertTokenStre public class WhitespaceTokenizerFactoryTests extends ESTestCase { public void testSimpleWhiteSpaceTokenizer() throws IOException { - final Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); + final Settings indexSettings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT).build(); IndexSettings indexProperties = IndexSettingsModule.newIndexSettings(new Index("test", "_na_"), indexSettings); WhitespaceTokenizer tokenizer = (WhitespaceTokenizer) new WhitespaceTokenizerFactory(indexProperties, null, "whitespace_maxlen", Settings.EMPTY).create(); @@ -51,7 +51,7 @@ public class WhitespaceTokenizerFactoryTests extends ESTestCase { } public void testMaxTokenLength() throws IOException { - final Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); + final Settings indexSettings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT).build(); IndexSettings indexProperties = IndexSettingsModule.newIndexSettings(new Index("test", "_na_"), indexSettings); final Settings settings = Settings.builder().put(WhitespaceTokenizerFactory.MAX_TOKEN_LENGTH, 2).build(); WhitespaceTokenizer tokenizer = (WhitespaceTokenizer) new WhitespaceTokenizerFactory(indexProperties, null, "whitespace_maxlen", diff --git a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/WordDelimiterGraphTokenFilterFactoryTests.java b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/WordDelimiterGraphTokenFilterFactoryTests.java index c8e3699ea84..ec61d614db9 100644 --- a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/WordDelimiterGraphTokenFilterFactoryTests.java +++ b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/WordDelimiterGraphTokenFilterFactoryTests.java @@ -21,7 +21,7 @@ package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.core.WhitespaceTokenizer; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.env.TestEnvironment; @@ -125,7 +125,7 @@ public class WordDelimiterGraphTokenFilterFactoryTests .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .build(); Settings indexSettings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_7_0_0, VersionUtils.getPreviousVersion(Version.V_7_3_0))) .put("index.analysis.analyzer.my_analyzer.tokenizer", "standard") .putList("index.analysis.analyzer.my_analyzer.filter", "word_delimiter_graph") @@ -148,7 +148,7 @@ public class WordDelimiterGraphTokenFilterFactoryTests .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .build(); Settings indexSettings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put("index.analysis.analyzer.my_analyzer.tokenizer", "standard") .putList("index.analysis.analyzer.my_analyzer.filter", "word_delimiter_graph") .build(); diff --git a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/DateIndexNameProcessor.java b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/DateIndexNameProcessor.java index e8e79c3d869..e5a7311da4c 100644 --- a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/DateIndexNameProcessor.java +++ b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/DateIndexNameProcessor.java @@ -102,7 +102,7 @@ public final class DateIndexNameProcessor extends AbstractProcessor { .append('}') .append('>'); String dynamicIndexName = builder.toString(); - ingestDocument.setFieldValue(IngestDocument.MetaData.INDEX.getFieldName(), dynamicIndexName); + ingestDocument.setFieldValue(IngestDocument.Metadata.INDEX.getFieldName(), dynamicIndexName); return ingestDocument; } diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/AppendProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/AppendProcessorTests.java index 7a48c9ace32..c1b7d62a2bb 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/AppendProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/AppendProcessorTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.ingest.common; import org.elasticsearch.ingest.IngestDocument; -import org.elasticsearch.ingest.IngestDocument.MetaData; +import org.elasticsearch.ingest.IngestDocument.Metadata; import org.elasticsearch.ingest.Processor; import org.elasticsearch.ingest.RandomDocumentPicks; import org.elasticsearch.ingest.TestTemplateService; @@ -126,25 +126,25 @@ public class AppendProcessorTests extends ESTestCase { public void testAppendMetadataExceptVersion() throws Exception { // here any metadata field value becomes a list, which won't make sense in most of the cases, // but support for append is streamlined like for set so we test it - MetaData randomMetaData = randomFrom(MetaData.INDEX, MetaData.TYPE, MetaData.ID, MetaData.ROUTING); + Metadata randomMetadata = randomFrom(Metadata.INDEX, Metadata.TYPE, Metadata.ID, Metadata.ROUTING); List values = new ArrayList<>(); Processor appendProcessor; if (randomBoolean()) { String value = randomAlphaOfLengthBetween(1, 10); values.add(value); - appendProcessor = createAppendProcessor(randomMetaData.getFieldName(), value); + appendProcessor = createAppendProcessor(randomMetadata.getFieldName(), value); } else { int valuesSize = randomIntBetween(0, 10); for (int i = 0; i < valuesSize; i++) { values.add(randomAlphaOfLengthBetween(1, 10)); } - appendProcessor = createAppendProcessor(randomMetaData.getFieldName(), values); + appendProcessor = createAppendProcessor(randomMetadata.getFieldName(), values); } IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random()); - Object initialValue = ingestDocument.getSourceAndMetadata().get(randomMetaData.getFieldName()); + Object initialValue = ingestDocument.getSourceAndMetadata().get(randomMetadata.getFieldName()); appendProcessor.execute(ingestDocument); - List list = ingestDocument.getFieldValue(randomMetaData.getFieldName(), List.class); + List list = ingestDocument.getFieldValue(randomMetadata.getFieldName(), List.class); if (initialValue == null) { assertThat(list, equalTo(values)); } else { diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ForEachProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ForEachProcessorTests.java index 8ab3061655a..42bfceae50b 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ForEachProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ForEachProcessorTests.java @@ -42,7 +42,7 @@ import static org.elasticsearch.ingest.IngestDocumentMatcher.assertIngestDocumen import static org.hamcrest.Matchers.equalTo; public class ForEachProcessorTests extends ESTestCase { - + public void testExecuteWithAsyncProcessor() throws Exception { List values = new ArrayList<>(); values.add("foo"); @@ -102,7 +102,7 @@ public class ForEachProcessorTests extends ESTestCase { assertThat(ingestDocument.getFieldValue("values", List.class), equalTo(Arrays.asList("A", "B", "c"))); } - public void testMetaDataAvailable() throws Exception { + public void testMetadataAvailable() throws Exception { List> values = new ArrayList<>(); values.add(new HashMap<>()); values.add(new HashMap<>()); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SetProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SetProcessorTests.java index cf698288268..f641ad604c3 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SetProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SetProcessorTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.ingest.common; import org.elasticsearch.ingest.IngestDocument; -import org.elasticsearch.ingest.IngestDocument.MetaData; +import org.elasticsearch.ingest.IngestDocument.Metadata; import org.elasticsearch.ingest.Processor; import org.elasticsearch.ingest.RandomDocumentPicks; import org.elasticsearch.ingest.TestTemplateService; @@ -101,27 +101,27 @@ public class SetProcessorTests extends ESTestCase { } public void testSetMetadataExceptVersion() throws Exception { - MetaData randomMetaData = randomFrom(MetaData.INDEX, MetaData.TYPE, MetaData.ID, MetaData.ROUTING); - Processor processor = createSetProcessor(randomMetaData.getFieldName(), "_value", true); + Metadata randomMetadata = randomFrom(Metadata.INDEX, Metadata.TYPE, Metadata.ID, Metadata.ROUTING); + Processor processor = createSetProcessor(randomMetadata.getFieldName(), "_value", true); IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random()); processor.execute(ingestDocument); - assertThat(ingestDocument.getFieldValue(randomMetaData.getFieldName(), String.class), Matchers.equalTo("_value")); + assertThat(ingestDocument.getFieldValue(randomMetadata.getFieldName(), String.class), Matchers.equalTo("_value")); } public void testSetMetadataVersion() throws Exception { long version = randomNonNegativeLong(); - Processor processor = createSetProcessor(MetaData.VERSION.getFieldName(), version, true); + Processor processor = createSetProcessor(Metadata.VERSION.getFieldName(), version, true); IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random()); processor.execute(ingestDocument); - assertThat(ingestDocument.getFieldValue(MetaData.VERSION.getFieldName(), Long.class), Matchers.equalTo(version)); + assertThat(ingestDocument.getFieldValue(Metadata.VERSION.getFieldName(), Long.class), Matchers.equalTo(version)); } public void testSetMetadataVersionType() throws Exception { String versionType = randomFrom("internal", "external", "external_gte"); - Processor processor = createSetProcessor(MetaData.VERSION_TYPE.getFieldName(), versionType, true); + Processor processor = createSetProcessor(Metadata.VERSION_TYPE.getFieldName(), versionType, true); IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random()); processor.execute(ingestDocument); - assertThat(ingestDocument.getFieldValue(MetaData.VERSION_TYPE.getFieldName(), String.class), Matchers.equalTo(versionType)); + assertThat(ingestDocument.getFieldValue(Metadata.VERSION_TYPE.getFieldName(), String.class), Matchers.equalTo(versionType)); } private static Processor createSetProcessor(String fieldName, Object fieldValue, boolean overrideEnabled) { diff --git a/modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/ScaledFloatFieldTypeTests.java b/modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/ScaledFloatFieldTypeTests.java index 1e4ab0b99a2..99afc1adc68 100644 --- a/modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/ScaledFloatFieldTypeTests.java +++ b/modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/ScaledFloatFieldTypeTests.java @@ -31,7 +31,7 @@ import org.apache.lucene.search.Query; import org.apache.lucene.store.Directory; import org.elasticsearch.core.internal.io.IOUtils; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.fielddata.LeafNumericFieldData; @@ -181,7 +181,7 @@ public class ScaledFloatFieldTypeTests extends FieldTypeTestCase { doc.add(new SortedNumericDocValuesField("scaled_float2", 12)); w.addDocument(doc); try (DirectoryReader reader = DirectoryReader.open(w)) { - IndexMetaData indexMetadata = new IndexMetaData.Builder("index").settings( + IndexMetadata indexMetadata = new IndexMetadata.Builder("index").settings( Settings.builder() .put("index.version.created", Version.CURRENT) .put("index.number_of_shards", 1) diff --git a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ChildrenAggregationBuilder.java b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ChildrenAggregationBuilder.java index 2bf55396a31..b298f4d7486 100644 --- a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ChildrenAggregationBuilder.java +++ b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ChildrenAggregationBuilder.java @@ -69,16 +69,16 @@ public class ChildrenAggregationBuilder } protected ChildrenAggregationBuilder(ChildrenAggregationBuilder clone, - Builder factoriesBuilder, Map metaData) { - super(clone, factoriesBuilder, metaData); + Builder factoriesBuilder, Map metadata) { + super(clone, factoriesBuilder, metadata); this.childType = clone.childType; this.childFilter = clone.childFilter; this.parentFilter = clone.parentFilter; } @Override - protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map metaData) { - return new ChildrenAggregationBuilder(this, factoriesBuilder, metaData); + protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map metadata) { + return new ChildrenAggregationBuilder(this, factoriesBuilder, metadata); } /** @@ -105,7 +105,7 @@ public class ChildrenAggregationBuilder AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { return new ChildrenAggregatorFactory(name, config, childFilter, parentFilter, queryShardContext, parent, - subFactoriesBuilder, metaData); + subFactoriesBuilder, metadata); } @Override diff --git a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ChildrenAggregatorFactory.java b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ChildrenAggregatorFactory.java index 57a746677f8..191da814282 100644 --- a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ChildrenAggregatorFactory.java +++ b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ChildrenAggregatorFactory.java @@ -48,8 +48,8 @@ public class ChildrenAggregatorFactory extends ValuesSourceAggregatorFactory metaData) throws IOException { - super(name, config, context, parent, subFactoriesBuilder, metaData); + Map metadata) throws IOException { + super(name, config, context, parent, subFactoriesBuilder, metadata); this.childFilter = childFilter; this.parentFilter = parentFilter; @@ -57,11 +57,11 @@ public class ChildrenAggregatorFactory extends ValuesSourceAggregatorFactory pipelineAggregators, Map metaData) throws IOException { - return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metaData) { + List pipelineAggregators, Map metadata) throws IOException { + return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) { @Override public InternalAggregation buildEmptyAggregation() { - return new InternalChildren(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metaData()); + return new InternalChildren(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata()); } }; } @@ -71,12 +71,12 @@ public class ChildrenAggregatorFactory extends ValuesSourceAggregatorFactory pipelineAggregators, - Map metaData) throws IOException { + Map metadata) throws IOException { long maxOrd = valuesSource.globalMaxOrd(searchContext.searcher()); if (collectsFromSingleBucket) { return new ParentToChildrenAggregator(name, factories, searchContext, parent, childFilter, - parentFilter, valuesSource, maxOrd, pipelineAggregators, metaData); + parentFilter, valuesSource, maxOrd, pipelineAggregators, metadata); } else { return asMultiBucketAggregator(this, searchContext, parent); } diff --git a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ChildrenToParentAggregator.java b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ChildrenToParentAggregator.java index 8c2ac5373b4..655e1ac3a60 100644 --- a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ChildrenToParentAggregator.java +++ b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ChildrenToParentAggregator.java @@ -42,19 +42,19 @@ public class ChildrenToParentAggregator extends ParentJoinAggregator { public ChildrenToParentAggregator(String name, AggregatorFactories factories, SearchContext context, Aggregator parent, Query childFilter, Query parentFilter, ValuesSource.Bytes.WithOrdinals valuesSource, - long maxOrd, List pipelineAggregators, Map metaData) throws IOException { - super(name, factories, context, parent, childFilter, parentFilter, valuesSource, maxOrd, pipelineAggregators, metaData); + long maxOrd, List pipelineAggregators, Map metadata) throws IOException { + super(name, factories, context, parent, childFilter, parentFilter, valuesSource, maxOrd, pipelineAggregators, metadata); } @Override public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException { return new InternalParent(name, bucketDocCount(owningBucketOrdinal), - bucketAggregations(owningBucketOrdinal), pipelineAggregators(), metaData()); + bucketAggregations(owningBucketOrdinal), pipelineAggregators(), metadata()); } @Override public InternalAggregation buildEmptyAggregation() { return new InternalParent(name, 0, buildEmptySubAggregations(), pipelineAggregators(), - metaData()); + metadata()); } } diff --git a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/InternalChildren.java b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/InternalChildren.java index 05cd40e3d33..99893fab962 100644 --- a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/InternalChildren.java +++ b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/InternalChildren.java @@ -33,8 +33,8 @@ import java.util.Map; */ public class InternalChildren extends InternalSingleBucketAggregation implements Children { public InternalChildren(String name, long docCount, InternalAggregations aggregations, List pipelineAggregators, - Map metaData) { - super(name, docCount, aggregations, pipelineAggregators, metaData); + Map metadata) { + super(name, docCount, aggregations, pipelineAggregators, metadata); } /** @@ -51,6 +51,6 @@ public class InternalChildren extends InternalSingleBucketAggregation implements @Override protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) { - return new InternalChildren(name, docCount, subAggregations, pipelineAggregators(), getMetaData()); + return new InternalChildren(name, docCount, subAggregations, pipelineAggregators(), getMetadata()); } } diff --git a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/InternalParent.java b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/InternalParent.java index f61589b1d9a..6ca0c075526 100644 --- a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/InternalParent.java +++ b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/InternalParent.java @@ -33,8 +33,8 @@ import java.util.Map; */ public class InternalParent extends InternalSingleBucketAggregation implements Parent { public InternalParent(String name, long docCount, InternalAggregations aggregations, List pipelineAggregators, - Map metaData) { - super(name, docCount, aggregations, pipelineAggregators, metaData); + Map metadata) { + super(name, docCount, aggregations, pipelineAggregators, metadata); } /** @@ -51,6 +51,6 @@ public class InternalParent extends InternalSingleBucketAggregation implements P @Override protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) { - return new InternalParent(name, docCount, subAggregations, pipelineAggregators(), getMetaData()); + return new InternalParent(name, docCount, subAggregations, pipelineAggregators(), getMetadata()); } } diff --git a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentAggregationBuilder.java b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentAggregationBuilder.java index 42eb0da5d24..6d41524c8ca 100644 --- a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentAggregationBuilder.java +++ b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentAggregationBuilder.java @@ -69,16 +69,16 @@ public class ParentAggregationBuilder } protected ParentAggregationBuilder(ParentAggregationBuilder clone, - Builder factoriesBuilder, Map metaData) { - super(clone, factoriesBuilder, metaData); + Builder factoriesBuilder, Map metadata) { + super(clone, factoriesBuilder, metadata); this.childType = clone.childType; this.childFilter = clone.childFilter; this.parentFilter = clone.parentFilter; } @Override - protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map metaData) { - return new ParentAggregationBuilder(this, factoriesBuilder, metaData); + protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map metadata) { + return new ParentAggregationBuilder(this, factoriesBuilder, metadata); } /** @@ -105,7 +105,7 @@ public class ParentAggregationBuilder AggregatorFactory parent, Builder subFactoriesBuilder) throws IOException { return new ParentAggregatorFactory(name, config, childFilter, parentFilter, queryShardContext, parent, - subFactoriesBuilder, metaData); + subFactoriesBuilder, metadata); } @Override diff --git a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentAggregatorFactory.java b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentAggregatorFactory.java index dc64d0308cd..1c932b1d53e 100644 --- a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentAggregatorFactory.java +++ b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentAggregatorFactory.java @@ -48,8 +48,8 @@ public class ParentAggregatorFactory extends ValuesSourceAggregatorFactory metaData) throws IOException { - super(name, config, queryShardContext, parent, subFactoriesBuilder, metaData); + Map metadata) throws IOException { + super(name, config, queryShardContext, parent, subFactoriesBuilder, metadata); this.childFilter = childFilter; this.parentFilter = parentFilter; @@ -57,11 +57,11 @@ public class ParentAggregatorFactory extends ValuesSourceAggregatorFactory pipelineAggregators, Map metaData) throws IOException { - return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metaData) { + List pipelineAggregators, Map metadata) throws IOException { + return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) { @Override public InternalAggregation buildEmptyAggregation() { - return new InternalParent(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metaData()); + return new InternalParent(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata()); } }; } @@ -71,12 +71,12 @@ public class ParentAggregatorFactory extends ValuesSourceAggregatorFactory pipelineAggregators, - Map metaData) throws IOException { + Map metadata) throws IOException { long maxOrd = valuesSource.globalMaxOrd(searchContext.searcher()); if (collectsFromSingleBucket) { return new ChildrenToParentAggregator(name, factories, searchContext, children, childFilter, - parentFilter, valuesSource, maxOrd, pipelineAggregators, metaData); + parentFilter, valuesSource, maxOrd, pipelineAggregators, metadata); } else { return asMultiBucketAggregator(this, searchContext, children); } diff --git a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentJoinAggregator.java b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentJoinAggregator.java index 46e358319a2..2e047897994 100644 --- a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentJoinAggregator.java +++ b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentJoinAggregator.java @@ -74,8 +74,8 @@ public abstract class ParentJoinAggregator extends BucketsAggregator implements ValuesSource.Bytes.WithOrdinals valuesSource, long maxOrd, List pipelineAggregators, - Map metaData) throws IOException { - super(name, factories, context, parent, pipelineAggregators, metaData); + Map metadata) throws IOException { + super(name, factories, context, parent, pipelineAggregators, metadata); if (maxOrd > Integer.MAX_VALUE) { throw new IllegalStateException("the number of parent [" + maxOrd + "] + is greater than the allowed limit " + diff --git a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentToChildrenAggregator.java b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentToChildrenAggregator.java index 813c8aeaf3a..08d924a9dbc 100644 --- a/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentToChildrenAggregator.java +++ b/modules/parent-join/src/main/java/org/elasticsearch/join/aggregations/ParentToChildrenAggregator.java @@ -38,19 +38,19 @@ public class ParentToChildrenAggregator extends ParentJoinAggregator { public ParentToChildrenAggregator(String name, AggregatorFactories factories, SearchContext context, Aggregator parent, Query childFilter, Query parentFilter, ValuesSource.Bytes.WithOrdinals valuesSource, - long maxOrd, List pipelineAggregators, Map metaData) throws IOException { - super(name, factories, context, parent, parentFilter, childFilter, valuesSource, maxOrd, pipelineAggregators, metaData); + long maxOrd, List pipelineAggregators, Map metadata) throws IOException { + super(name, factories, context, parent, parentFilter, childFilter, valuesSource, maxOrd, pipelineAggregators, metadata); } @Override public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException { return new InternalChildren(name, bucketDocCount(owningBucketOrdinal), - bucketAggregations(owningBucketOrdinal), pipelineAggregators(), metaData()); + bucketAggregations(owningBucketOrdinal), pipelineAggregators(), metadata()); } @Override public InternalAggregation buildEmptyAggregation() { return new InternalChildren(name, 0, buildEmptySubAggregations(), pipelineAggregators(), - metaData()); + metadata()); } } diff --git a/modules/parent-join/src/main/java/org/elasticsearch/join/mapper/ParentJoinFieldMapper.java b/modules/parent-join/src/main/java/org/elasticsearch/join/mapper/ParentJoinFieldMapper.java index 4c7c14893af..90a7dc94bf5 100644 --- a/modules/parent-join/src/main/java/org/elasticsearch/join/mapper/ParentJoinFieldMapper.java +++ b/modules/parent-join/src/main/java/org/elasticsearch/join/mapper/ParentJoinFieldMapper.java @@ -94,7 +94,7 @@ public final class ParentJoinFieldMapper extends FieldMapper { } private static void checkIndexCompatibility(IndexSettings settings, String name) { - if (settings.getIndexMetaData().isRoutingPartitionedIndex()) { + if (settings.getIndexMetadata().isRoutingPartitionedIndex()) { throw new IllegalStateException("cannot create join field [" + name + "] " + "for the partitioned index " + "[" + settings.getIndex().getName() + "]"); } diff --git a/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/ChildrenIT.java b/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/ChildrenIT.java index f611066a9c4..239f6275932 100644 --- a/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/ChildrenIT.java +++ b/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/ChildrenIT.java @@ -23,7 +23,7 @@ import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.update.UpdateResponse; import org.elasticsearch.client.Requests; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.aggregations.AggregationBuilders; @@ -220,8 +220,8 @@ public class ChildrenIT extends AbstractParentChildTestCase { String childType = "variantsku"; assertAcked( prepareCreate(indexName) - .setSettings(Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) - .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)) + .setSettings(Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)) .addMapping("doc", addFieldMappings(buildParentJoinFieldMappingFromSimplifiedDef("join_field", true, masterType, childType), diff --git a/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/ChildrenToParentAggregatorTests.java b/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/ChildrenToParentAggregatorTests.java index a161e2a6a13..bbaa4e00ca9 100644 --- a/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/ChildrenToParentAggregatorTests.java +++ b/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/ChildrenToParentAggregatorTests.java @@ -33,7 +33,7 @@ import org.apache.lucene.search.TermInSetQuery; import org.apache.lucene.store.Directory; import org.apache.lucene.util.BytesRef; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.lucene.index.ElasticsearchDirectoryReader; import org.elasticsearch.common.settings.Settings; @@ -282,7 +282,7 @@ public class ChildrenToParentAggregatorTests extends AggregatorTestCase { } private static ParentJoinFieldMapper createJoinFieldMapper() { - Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); + Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT).build(); return new ParentJoinFieldMapper.Builder("join_field") .addParent(PARENT_TYPE, Collections.singleton(CHILD_TYPE)) .build(new Mapper.BuilderContext(settings, new ContentPath(0))); diff --git a/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/InternalChildrenTests.java b/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/InternalChildrenTests.java index 95cff14ef00..ebc3d74d828 100644 --- a/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/InternalChildrenTests.java +++ b/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/InternalChildrenTests.java @@ -45,8 +45,8 @@ public class InternalChildrenTests extends InternalSingleBucketAggregationTestCa @Override protected InternalChildren createTestInstance(String name, long docCount, InternalAggregations aggregations, - List pipelineAggregators, Map metaData) { - return new InternalChildren(name, docCount, aggregations, pipelineAggregators, metaData); + List pipelineAggregators, Map metadata) { + return new InternalChildren(name, docCount, aggregations, pipelineAggregators, metadata); } @Override diff --git a/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/InternalParentTests.java b/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/InternalParentTests.java index be4792a867d..6ad0900f4ef 100644 --- a/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/InternalParentTests.java +++ b/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/InternalParentTests.java @@ -44,8 +44,8 @@ public class InternalParentTests extends InternalSingleBucketAggregationTestCase @Override protected InternalParent createTestInstance(String name, long docCount, InternalAggregations aggregations, - List pipelineAggregators, Map metaData) { - return new InternalParent(name, docCount, aggregations, pipelineAggregators, metaData); + List pipelineAggregators, Map metadata) { + return new InternalParent(name, docCount, aggregations, pipelineAggregators, metadata); } @Override diff --git a/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/ParentToChildrenAggregatorTests.java b/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/ParentToChildrenAggregatorTests.java index 5607ecfb0e7..34ad85aedea 100644 --- a/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/ParentToChildrenAggregatorTests.java +++ b/modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/ParentToChildrenAggregatorTests.java @@ -33,7 +33,7 @@ import org.apache.lucene.search.TermInSetQuery; import org.apache.lucene.store.Directory; import org.apache.lucene.util.BytesRef; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.lucene.index.ElasticsearchDirectoryReader; import org.elasticsearch.common.settings.Settings; @@ -170,7 +170,7 @@ public class ParentToChildrenAggregatorTests extends AggregatorTestCase { } private static ParentJoinFieldMapper createJoinFieldMapper() { - Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); + Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT).build(); return new ParentJoinFieldMapper.Builder("join_field") .addParent(PARENT_TYPE, Collections.singleton(CHILD_TYPE)) .build(new Mapper.BuilderContext(settings, new ContentPath(0))); diff --git a/modules/parent-join/src/test/java/org/elasticsearch/join/query/HasChildQueryBuilderTests.java b/modules/parent-join/src/test/java/org/elasticsearch/join/query/HasChildQueryBuilderTests.java index a9949856f89..e6ed3455ce6 100644 --- a/modules/parent-join/src/test/java/org/elasticsearch/join/query/HasChildQueryBuilderTests.java +++ b/modules/parent-join/src/test/java/org/elasticsearch/join/query/HasChildQueryBuilderTests.java @@ -33,7 +33,7 @@ import org.apache.lucene.search.similarities.PerFieldSimilarityWrapper; import org.apache.lucene.search.similarities.Similarity; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Strings; import org.elasticsearch.common.compress.CompressedXContent; import org.elasticsearch.common.settings.Settings; @@ -92,7 +92,7 @@ public class HasChildQueryBuilderTests extends AbstractQueryTestCase docs) { - IndexMetaData build = IndexMetaData.builder("") - .settings(Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)) + IndexMetadata build = IndexMetadata.builder("") + .settings(Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)) .numberOfShards(1).numberOfReplicas(0).build(); IndexSettings settings = new IndexSettings(build, Settings.EMPTY); ParseContext.InternalParseContext parseContext = new ParseContext.InternalParseContext(settings, diff --git a/modules/percolator/src/test/java/org/elasticsearch/percolator/PercolatorFieldMapperTests.java b/modules/percolator/src/test/java/org/elasticsearch/percolator/PercolatorFieldMapperTests.java index fa7c6d7bde0..791bf183cca 100644 --- a/modules/percolator/src/test/java/org/elasticsearch/percolator/PercolatorFieldMapperTests.java +++ b/modules/percolator/src/test/java/org/elasticsearch/percolator/PercolatorFieldMapperTests.java @@ -42,7 +42,7 @@ import org.apache.lucene.search.join.ScoreMode; import org.apache.lucene.util.BytesRef; import org.elasticsearch.Version; import org.elasticsearch.action.support.PlainActionFuture; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Strings; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesReference; @@ -183,8 +183,8 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase { DocumentMapper documentMapper = mapperService.documentMapper("doc"); PercolatorFieldMapper fieldMapper = (PercolatorFieldMapper) documentMapper.mappers().getMapper(fieldName); - IndexMetaData build = IndexMetaData.builder("") - .settings(Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)) + IndexMetadata build = IndexMetadata.builder("") + .settings(Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)) .numberOfShards(1).numberOfReplicas(0).build(); IndexSettings settings = new IndexSettings(build, Settings.EMPTY); ParseContext.InternalParseContext parseContext = new ParseContext.InternalParseContext(settings, @@ -237,8 +237,8 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase { bq.add(rangeQuery2, Occur.MUST); DocumentMapper documentMapper = mapperService.documentMapper("doc"); - IndexMetaData build = IndexMetaData.builder("") - .settings(Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)) + IndexMetadata build = IndexMetadata.builder("") + .settings(Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)) .numberOfShards(1).numberOfReplicas(0).build(); IndexSettings settings = new IndexSettings(build, Settings.EMPTY); PercolatorFieldMapper fieldMapper = (PercolatorFieldMapper) documentMapper.mappers().getMapper(fieldName); @@ -292,8 +292,8 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase { TermRangeQuery query = new TermRangeQuery("field1", new BytesRef("a"), new BytesRef("z"), true, true); DocumentMapper documentMapper = mapperService.documentMapper("doc"); PercolatorFieldMapper fieldMapper = (PercolatorFieldMapper) documentMapper.mappers().getMapper(fieldName); - IndexMetaData build = IndexMetaData.builder("") - .settings(Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)) + IndexMetadata build = IndexMetadata.builder("") + .settings(Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)) .numberOfShards(1).numberOfReplicas(0).build(); IndexSettings settings = new IndexSettings(build, Settings.EMPTY); ParseContext.InternalParseContext parseContext = new ParseContext.InternalParseContext(settings, @@ -311,8 +311,8 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase { PhraseQuery phraseQuery = new PhraseQuery("field", "term"); DocumentMapper documentMapper = mapperService.documentMapper("doc"); PercolatorFieldMapper fieldMapper = (PercolatorFieldMapper) documentMapper.mappers().getMapper(fieldName); - IndexMetaData build = IndexMetaData.builder("") - .settings(Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)) + IndexMetadata build = IndexMetadata.builder("") + .settings(Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT)) .numberOfShards(1).numberOfReplicas(0).build(); IndexSettings settings = new IndexSettings(build, Settings.EMPTY); ParseContext.InternalParseContext parseContext = new ParseContext.InternalParseContext(settings, diff --git a/modules/percolator/src/test/java/org/elasticsearch/percolator/QueryBuilderStoreTests.java b/modules/percolator/src/test/java/org/elasticsearch/percolator/QueryBuilderStoreTests.java index ff9688487d3..6f3ec27f4fe 100644 --- a/modules/percolator/src/test/java/org/elasticsearch/percolator/QueryBuilderStoreTests.java +++ b/modules/percolator/src/test/java/org/elasticsearch/percolator/QueryBuilderStoreTests.java @@ -29,7 +29,7 @@ import org.apache.lucene.search.Query; import org.apache.lucene.search.TermQuery; import org.apache.lucene.store.Directory; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.CheckedFunction; import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.settings.Settings; @@ -72,7 +72,7 @@ public class QueryBuilderStoreTests extends ESTestCase { TermQueryBuilder[] queryBuilders = new TermQueryBuilder[randomIntBetween(1, 16)]; IndexWriterConfig config = new IndexWriterConfig(new WhitespaceAnalyzer()); config.setMergePolicy(NoMergePolicy.INSTANCE); - Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); + Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT).build(); BinaryFieldMapper fieldMapper = PercolatorFieldMapper.Builder.createQueryBuilderFieldBuilder( new Mapper.BuilderContext(settings, new ContentPath(0))); diff --git a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/DeleteByQueryBasicTests.java b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/DeleteByQueryBasicTests.java index 350fe794a77..153b8dac235 100644 --- a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/DeleteByQueryBasicTests.java +++ b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/DeleteByQueryBasicTests.java @@ -41,8 +41,8 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_READ_ONLY; -import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_READ_ONLY_ALLOW_DELETE; +import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_READ_ONLY; +import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_READ_ONLY_ALLOW_DELETE; import static org.elasticsearch.index.query.QueryBuilders.matchQuery; import static org.elasticsearch.index.query.QueryBuilders.rangeQuery; import static org.elasticsearch.index.query.QueryBuilders.termQuery; diff --git a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/ReindexSourceTargetValidationTests.java b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/ReindexSourceTargetValidationTests.java index 99c9a83de32..df08634f722 100644 --- a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/ReindexSourceTargetValidationTests.java +++ b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/ReindexSourceTargetValidationTests.java @@ -26,10 +26,10 @@ import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.support.AutoCreateIndex; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.metadata.AliasMetaData; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.AliasMetadata; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesReference; @@ -47,7 +47,7 @@ import static org.hamcrest.Matchers.containsString; * cluster.... */ public class ReindexSourceTargetValidationTests extends ESTestCase { - private static final ClusterState STATE = ClusterState.builder(new ClusterName("test")).metaData(MetaData.builder() + private static final ClusterState STATE = ClusterState.builder(new ClusterName("test")).metadata(Metadata.builder() .put(index("target", "target_alias", "target_multi"), true) .put(index("target2", "target_multi"), true) .put(index("target_with_write_index", true, "target_multi_with_write_index"), true) @@ -130,17 +130,17 @@ public class ReindexSourceTargetValidationTests extends ESTestCase { INDEX_NAME_EXPRESSION_RESOLVER, AUTO_CREATE_INDEX, STATE); } - private static IndexMetaData index(String name, String... aliases) { + private static IndexMetadata index(String name, String... aliases) { return index(name, null, aliases); } - private static IndexMetaData index(String name, @Nullable Boolean writeIndex, String... aliases) { - IndexMetaData.Builder builder = IndexMetaData.builder(name).settings(Settings.builder() + private static IndexMetadata index(String name, @Nullable Boolean writeIndex, String... aliases) { + IndexMetadata.Builder builder = IndexMetadata.builder(name).settings(Settings.builder() .put("index.version.created", Version.CURRENT.id) .put("index.number_of_shards", 1) .put("index.number_of_replicas", 1)); for (String alias: aliases) { - builder.putAlias(AliasMetaData.builder(alias).writeIndex(writeIndex).build()); + builder.putAlias(AliasMetadata.builder(alias).writeIndex(writeIndex).build()); } return builder.build(); } diff --git a/modules/repository-url/src/main/java/org/elasticsearch/common/blobstore/url/URLBlobContainer.java b/modules/repository-url/src/main/java/org/elasticsearch/common/blobstore/url/URLBlobContainer.java index 35174557f1e..d14a4c64edc 100644 --- a/modules/repository-url/src/main/java/org/elasticsearch/common/blobstore/url/URLBlobContainer.java +++ b/modules/repository-url/src/main/java/org/elasticsearch/common/blobstore/url/URLBlobContainer.java @@ -21,7 +21,7 @@ package org.elasticsearch.common.blobstore.url; import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.blobstore.BlobContainer; -import org.elasticsearch.common.blobstore.BlobMetaData; +import org.elasticsearch.common.blobstore.BlobMetadata; import org.elasticsearch.common.blobstore.BlobPath; import org.elasticsearch.common.blobstore.DeleteResult; import org.elasticsearch.common.blobstore.support.AbstractBlobContainer; @@ -73,7 +73,7 @@ public class URLBlobContainer extends AbstractBlobContainer { * This operation is not supported by URLBlobContainer */ @Override - public Map listBlobs() throws IOException { + public Map listBlobs() throws IOException { throw new UnsupportedOperationException("URL repository doesn't support this operation"); } @@ -86,7 +86,7 @@ public class URLBlobContainer extends AbstractBlobContainer { * This operation is not supported by URLBlobContainer */ @Override - public Map listBlobsByPrefix(String blobNamePrefix) throws IOException { + public Map listBlobsByPrefix(String blobNamePrefix) throws IOException { throw new UnsupportedOperationException("URL repository doesn't support this operation"); } diff --git a/modules/repository-url/src/main/java/org/elasticsearch/repositories/url/URLRepository.java b/modules/repository-url/src/main/java/org/elasticsearch/repositories/url/URLRepository.java index 8a8f0ef7e84..56aa2315fe6 100644 --- a/modules/repository-url/src/main/java/org/elasticsearch/repositories/url/URLRepository.java +++ b/modules/repository-url/src/main/java/org/elasticsearch/repositories/url/URLRepository.java @@ -21,7 +21,7 @@ package org.elasticsearch.repositories.url; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.blobstore.BlobContainer; import org.elasticsearch.common.blobstore.BlobPath; @@ -82,7 +82,7 @@ public class URLRepository extends BlobStoreRepository { /** * Constructs a read-only URL-based repository */ - public URLRepository(RepositoryMetaData metadata, Environment environment, + public URLRepository(RepositoryMetadata metadata, Environment environment, NamedXContentRegistry namedXContentRegistry, ClusterService clusterService) { super(metadata, false, namedXContentRegistry, clusterService); diff --git a/modules/repository-url/src/test/java/org/elasticsearch/repositories/url/URLRepositoryTests.java b/modules/repository-url/src/test/java/org/elasticsearch/repositories/url/URLRepositoryTests.java index 823571462d2..2ffe0bd042d 100644 --- a/modules/repository-url/src/test/java/org/elasticsearch/repositories/url/URLRepositoryTests.java +++ b/modules/repository-url/src/test/java/org/elasticsearch/repositories/url/URLRepositoryTests.java @@ -19,7 +19,7 @@ package org.elasticsearch.repositories.url; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.NamedXContentRegistry; import org.elasticsearch.env.Environment; @@ -38,8 +38,8 @@ import static org.hamcrest.CoreMatchers.nullValue; public class URLRepositoryTests extends ESTestCase { - private URLRepository createRepository(Settings baseSettings, RepositoryMetaData repositoryMetaData) { - return new URLRepository(repositoryMetaData, TestEnvironment.newEnvironment(baseSettings), + private URLRepository createRepository(Settings baseSettings, RepositoryMetadata repositoryMetadata) { + return new URLRepository(repositoryMetadata, TestEnvironment.newEnvironment(baseSettings), new NamedXContentRegistry(Collections.emptyList()), BlobStoreTestUtil.mockClusterService()) { @Override protected void assertSnapshotOrGenericThread() { @@ -55,8 +55,8 @@ public class URLRepositoryTests extends ESTestCase { .put(URLRepository.ALLOWED_URLS_SETTING.getKey(), repoPath) .put(URLRepository.REPOSITORIES_URL_SETTING.getKey(), repoPath) .build(); - RepositoryMetaData repositoryMetaData = new RepositoryMetaData("url", URLRepository.TYPE, baseSettings); - final URLRepository repository = createRepository(baseSettings, repositoryMetaData); + RepositoryMetadata repositoryMetadata = new RepositoryMetadata("url", URLRepository.TYPE, baseSettings); + final URLRepository repository = createRepository(baseSettings, repositoryMetadata); repository.start(); assertThat("blob store has to be lazy initialized", repository.getBlobStore(), is(nullValue())); @@ -70,8 +70,8 @@ public class URLRepositoryTests extends ESTestCase { .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put(URLRepository.REPOSITORIES_URL_SETTING.getKey(), repoPath) .build(); - RepositoryMetaData repositoryMetaData = new RepositoryMetaData("url", URLRepository.TYPE, baseSettings); - final URLRepository repository = createRepository(baseSettings, repositoryMetaData); + RepositoryMetadata repositoryMetadata = new RepositoryMetadata("url", URLRepository.TYPE, baseSettings); + final URLRepository repository = createRepository(baseSettings, repositoryMetadata); repository.start(); try { repository.blobContainer(); @@ -92,8 +92,8 @@ public class URLRepositoryTests extends ESTestCase { .put(URLRepository.REPOSITORIES_URL_SETTING.getKey(), repoPath) .put(URLRepository.SUPPORTED_PROTOCOLS_SETTING.getKey(), "http,https") .build(); - RepositoryMetaData repositoryMetaData = new RepositoryMetaData("url", URLRepository.TYPE, baseSettings); - final URLRepository repository = createRepository(baseSettings, repositoryMetaData); + RepositoryMetadata repositoryMetadata = new RepositoryMetadata("url", URLRepository.TYPE, baseSettings); + final URLRepository repository = createRepository(baseSettings, repositoryMetadata); repository.start(); try { repository.blobContainer(); @@ -109,8 +109,8 @@ public class URLRepositoryTests extends ESTestCase { .put(URLRepository.ALLOWED_URLS_SETTING.getKey(), "file:/tmp/") .put(URLRepository.REPOSITORIES_URL_SETTING.getKey(), "file:/var/" ) .build(); - RepositoryMetaData repositoryMetaData = new RepositoryMetaData("url", URLRepository.TYPE, baseSettings); - final URLRepository repository = createRepository(baseSettings, repositoryMetaData); + RepositoryMetadata repositoryMetadata = new RepositoryMetadata("url", URLRepository.TYPE, baseSettings); + final URLRepository repository = createRepository(baseSettings, repositoryMetadata); repository.start(); try { repository.blobContainer(); diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/rest/discovery/Zen2RestApiIT.java b/modules/transport-netty4/src/test/java/org/elasticsearch/rest/discovery/Zen2RestApiIT.java index eb2eb14b66f..655b0792f61 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/rest/discovery/Zen2RestApiIT.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/rest/discovery/Zen2RestApiIT.java @@ -28,7 +28,7 @@ import org.elasticsearch.client.Request; import org.elasticsearch.client.Response; import org.elasticsearch.client.ResponseException; import org.elasticsearch.client.RestClient; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.routing.UnassignedInfo; import org.elasticsearch.common.Priority; import org.elasticsearch.common.settings.Settings; @@ -61,8 +61,8 @@ public class Zen2RestApiIT extends ESNetty4IntegTestCase { createIndex("test", Settings.builder() .put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), TimeValue.ZERO) // assign shards - .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 2) // causes rebalancing - .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) + .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 2) // causes rebalancing + .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1) .build()); ensureGreen("test"); diff --git a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/IcuAnalyzerTests.java b/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/IcuAnalyzerTests.java index d15c9524db1..60e9a76738e 100644 --- a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/IcuAnalyzerTests.java +++ b/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/IcuAnalyzerTests.java @@ -22,7 +22,7 @@ package org.elasticsearch.index.analysis; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.BaseTokenStreamTestCase; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin; @@ -37,7 +37,7 @@ public class IcuAnalyzerTests extends BaseTokenStreamTestCase { public void testMixedAlphabetTokenization() throws IOException { Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .build(); IndexSettings idxSettings = IndexSettingsModule.newIndexSettings("index", settings); @@ -52,7 +52,7 @@ public class IcuAnalyzerTests extends BaseTokenStreamTestCase { public void testMiddleDots() throws IOException { Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .build(); IndexSettings idxSettings = IndexSettingsModule.newIndexSettings("index", settings); @@ -66,7 +66,7 @@ public class IcuAnalyzerTests extends BaseTokenStreamTestCase { public void testUnicodeNumericCharacters() throws IOException { Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .build(); IndexSettings idxSettings = IndexSettingsModule.newIndexSettings("index", settings); @@ -80,7 +80,7 @@ public class IcuAnalyzerTests extends BaseTokenStreamTestCase { public void testBadSettings() { Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put("mode", "wrong") .build(); IndexSettings idxSettings = IndexSettingsModule.newIndexSettings("index", settings); diff --git a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/IcuTokenizerFactoryTests.java b/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/IcuTokenizerFactoryTests.java index 8cce4c13542..72c88c30dca 100644 --- a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/IcuTokenizerFactoryTests.java +++ b/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/IcuTokenizerFactoryTests.java @@ -21,7 +21,7 @@ package org.elasticsearch.index.analysis; import org.apache.lucene.analysis.icu.segmentation.ICUTokenizer; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.Index; @@ -96,7 +96,7 @@ public class IcuTokenizerFactoryTests extends ESTestCase { Settings settings = Settings.builder() .loadFromStream(json, IcuTokenizerFactoryTests.class.getResourceAsStream(json), false) - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .build(); Settings nodeSettings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), home).build(); diff --git a/plugins/analysis-kuromoji/src/test/java/org/elasticsearch/index/analysis/KuromojiAnalysisTests.java b/plugins/analysis-kuromoji/src/test/java/org/elasticsearch/index/analysis/KuromojiAnalysisTests.java index 9add830c26c..ab684c5a62d 100644 --- a/plugins/analysis-kuromoji/src/test/java/org/elasticsearch/index/analysis/KuromojiAnalysisTests.java +++ b/plugins/analysis-kuromoji/src/test/java/org/elasticsearch/index/analysis/KuromojiAnalysisTests.java @@ -26,7 +26,7 @@ import org.apache.lucene.analysis.ja.JapaneseAnalyzer; import org.apache.lucene.analysis.ja.JapaneseTokenizer; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.Index; @@ -214,7 +214,7 @@ public class KuromojiAnalysisTests extends ESTestCase { Settings settings = Settings.builder() .loadFromStream(json, KuromojiAnalysisTests.class.getResourceAsStream(json), false) - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .build(); Settings nodeSettings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), home).build(); return createTestAnalysis(new Index("test", "_na_"), nodeSettings, settings, new AnalysisKuromojiPlugin()); @@ -355,7 +355,7 @@ public class KuromojiAnalysisTests extends ESTestCase { Files.createDirectory(config); Files.copy(dict, config.resolve("user_dict.txt")); Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put(Environment.PATH_HOME_SETTING.getKey(), home) .put(analysisSettings) .build(); diff --git a/plugins/analysis-nori/src/test/java/org/elasticsearch/index/analysis/NoriAnalysisTests.java b/plugins/analysis-nori/src/test/java/org/elasticsearch/index/analysis/NoriAnalysisTests.java index 87c78c7f981..bc1f7b95ba1 100644 --- a/plugins/analysis-nori/src/test/java/org/elasticsearch/index/analysis/NoriAnalysisTests.java +++ b/plugins/analysis-nori/src/test/java/org/elasticsearch/index/analysis/NoriAnalysisTests.java @@ -25,7 +25,7 @@ import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.ko.KoreanAnalyzer; import org.apache.lucene.analysis.ko.KoreanTokenizer; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.plugin.analysis.nori.AnalysisNoriPlugin; @@ -177,7 +177,7 @@ public class NoriAnalysisTests extends ESTokenStreamTestCase { public void testNoriReadingForm() throws IOException { Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put("index.analysis.filter.my_filter.type", "nori_readingform") .build(); @@ -191,7 +191,7 @@ public class NoriAnalysisTests extends ESTokenStreamTestCase { public void testNoriNumber() throws IOException { Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put("index.analysis.filter.my_filter.type", "nori_number") .build(); @@ -217,7 +217,7 @@ public class NoriAnalysisTests extends ESTokenStreamTestCase { Files.createDirectory(config); Files.copy(dict, config.resolve("user_dict.txt")); Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put(Environment.PATH_HOME_SETTING.getKey(), home) .put(analysisSettings) .build(); diff --git a/plugins/analysis-phonetic/src/test/java/org/elasticsearch/index/analysis/AnalysisPhoneticFactoryTests.java b/plugins/analysis-phonetic/src/test/java/org/elasticsearch/index/analysis/AnalysisPhoneticFactoryTests.java index 2092d63fd23..5366c4621b1 100644 --- a/plugins/analysis-phonetic/src/test/java/org/elasticsearch/index/analysis/AnalysisPhoneticFactoryTests.java +++ b/plugins/analysis-phonetic/src/test/java/org/elasticsearch/index/analysis/AnalysisPhoneticFactoryTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.index.analysis; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.indices.analysis.AnalysisFactoryTestCase; @@ -51,7 +51,7 @@ public class AnalysisPhoneticFactoryTests extends AnalysisFactoryTestCase { AnalysisPhoneticPlugin plugin = new AnalysisPhoneticPlugin(); Settings settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_7_0_0, Version.CURRENT)) + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_7_0_0, Version.CURRENT)) .put("path.home", createTempDir().toString()) .build(); IndexSettings idxSettings = IndexSettingsModule.newIndexSettings("index", settings); @@ -62,7 +62,7 @@ public class AnalysisPhoneticFactoryTests extends AnalysisFactoryTestCase { assertEquals("Token filter [phonetic] cannot be used to parse synonyms", e.getMessage()); settings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), + .put(IndexMetadata.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_0_0))) .put("path.home", createTempDir().toString()) .build(); diff --git a/plugins/analysis-phonetic/src/test/java/org/elasticsearch/index/analysis/SimplePhoneticAnalysisTests.java b/plugins/analysis-phonetic/src/test/java/org/elasticsearch/index/analysis/SimplePhoneticAnalysisTests.java index 7fad525b33c..f463c0d2037 100644 --- a/plugins/analysis-phonetic/src/test/java/org/elasticsearch/index/analysis/SimplePhoneticAnalysisTests.java +++ b/plugins/analysis-phonetic/src/test/java/org/elasticsearch/index/analysis/SimplePhoneticAnalysisTests.java @@ -24,7 +24,7 @@ import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.core.WhitespaceTokenizer; import org.apache.lucene.analysis.phonetic.DaitchMokotoffSoundexFilter; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.plugin.analysis.AnalysisPhoneticPlugin; @@ -45,7 +45,7 @@ public class SimplePhoneticAnalysisTests extends ESTestCase { public void setup() throws IOException { String yaml = "/org/elasticsearch/index/analysis/phonetic-1.yml"; Settings settings = Settings.builder().loadFromStream(yaml, getClass().getResourceAsStream(yaml), false) - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .build(); this.analysis = createTestAnalysis(new Index("test", "_na_"), settings, new AnalysisPhoneticPlugin()); } diff --git a/plugins/analysis-stempel/src/test/java/org/elasticsearch/index/analysis/AnalysisPolishFactoryTests.java b/plugins/analysis-stempel/src/test/java/org/elasticsearch/index/analysis/AnalysisPolishFactoryTests.java index f13d7b01149..536f2c57f20 100644 --- a/plugins/analysis-stempel/src/test/java/org/elasticsearch/index/analysis/AnalysisPolishFactoryTests.java +++ b/plugins/analysis-stempel/src/test/java/org/elasticsearch/index/analysis/AnalysisPolishFactoryTests.java @@ -24,7 +24,7 @@ import org.apache.lucene.analysis.BaseTokenStreamTestCase; import org.apache.lucene.analysis.MockTokenizer; import org.apache.lucene.analysis.Tokenizer; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.UUIDs; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; @@ -54,15 +54,15 @@ public class AnalysisPolishFactoryTests extends AnalysisFactoryTestCase { // TODO: is this the right boilerplate? I forked this out of TransportAnalyzeAction.java: Settings settings = Settings.builder() // for _na_ - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) - .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) - .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) - .put(IndexMetaData.SETTING_INDEX_UUID, UUIDs.randomBase64UUID()) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) + .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + .put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID()) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .build(); Environment environment = TestEnvironment.newEnvironment(settings); - IndexMetaData metaData = IndexMetaData.builder(IndexMetaData.INDEX_UUID_NA_VALUE).settings(settings).build(); - IndexSettings indexSettings = new IndexSettings(metaData, Settings.EMPTY); + IndexMetadata metadata = IndexMetadata.builder(IndexMetadata.INDEX_UUID_NA_VALUE).settings(settings).build(); + IndexSettings indexSettings = new IndexSettings(metadata, Settings.EMPTY); testThreadSafety(new PolishStemTokenFilterFactory(indexSettings, environment, "stempelpolishstem", settings)); } diff --git a/plugins/examples/security-authorization-engine/src/test/java/org/elasticsearch/example/CustomAuthorizationEngineTests.java b/plugins/examples/security-authorization-engine/src/test/java/org/elasticsearch/example/CustomAuthorizationEngineTests.java index b9d0495b247..f9b181d9dcb 100644 --- a/plugins/examples/security-authorization-engine/src/test/java/org/elasticsearch/example/CustomAuthorizationEngineTests.java +++ b/plugins/examples/security-authorization-engine/src/test/java/org/elasticsearch/example/CustomAuthorizationEngineTests.java @@ -24,7 +24,7 @@ import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.cluster.metadata.IndexAbstraction; import org.elasticsearch.cluster.metadata.IndexAbstraction.Index; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.transport.TransportRequest; @@ -131,7 +131,7 @@ public class CustomAuthorizationEngineTests extends ESTestCase { public void testAuthorizeIndexAction() { CustomAuthorizationEngine engine = new CustomAuthorizationEngine(); Map indicesMap = new HashMap<>(); - indicesMap.put("index", new Index(IndexMetaData.builder("index") + indicesMap.put("index", new Index(IndexMetadata.builder("index") .settings(Settings.builder().put("index.version.created", Version.CURRENT)) .numberOfShards(1) .numberOfReplicas(0) diff --git a/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureBlobContainer.java b/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureBlobContainer.java index 2093139e115..bd1f85c7809 100644 --- a/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureBlobContainer.java +++ b/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureBlobContainer.java @@ -29,7 +29,7 @@ import org.elasticsearch.action.support.GroupedActionListener; import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.blobstore.BlobContainer; -import org.elasticsearch.common.blobstore.BlobMetaData; +import org.elasticsearch.common.blobstore.BlobMetadata; import org.elasticsearch.common.blobstore.BlobPath; import org.elasticsearch.common.blobstore.DeleteResult; import org.elasticsearch.common.blobstore.support.AbstractBlobContainer; @@ -152,7 +152,7 @@ public class AzureBlobContainer extends AbstractBlobContainer { } @Override - public Map listBlobsByPrefix(@Nullable String prefix) throws IOException { + public Map listBlobsByPrefix(@Nullable String prefix) throws IOException { logger.trace("listBlobsByPrefix({})", prefix); try { @@ -164,7 +164,7 @@ public class AzureBlobContainer extends AbstractBlobContainer { } @Override - public Map listBlobs() throws IOException { + public Map listBlobs() throws IOException { logger.trace("listBlobs()"); return listBlobsByPrefix(null); } diff --git a/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureBlobStore.java b/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureBlobStore.java index 714e29edea2..3c0e0175963 100644 --- a/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureBlobStore.java +++ b/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureBlobStore.java @@ -21,9 +21,9 @@ package org.elasticsearch.repositories.azure; import com.microsoft.azure.storage.LocationMode; import com.microsoft.azure.storage.StorageException; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.common.blobstore.BlobContainer; -import org.elasticsearch.common.blobstore.BlobMetaData; +import org.elasticsearch.common.blobstore.BlobMetadata; import org.elasticsearch.common.blobstore.BlobPath; import org.elasticsearch.common.blobstore.BlobStore; import org.elasticsearch.common.blobstore.DeleteResult; @@ -50,7 +50,7 @@ public class AzureBlobStore implements BlobStore { private final String container; private final LocationMode locationMode; - public AzureBlobStore(RepositoryMetaData metadata, AzureStorageService service, ThreadPool threadPool) { + public AzureBlobStore(RepositoryMetadata metadata, AzureStorageService service, ThreadPool threadPool) { this.container = Repository.CONTAINER_SETTING.get(metadata.settings()); this.clientName = Repository.CLIENT_NAME.get(metadata.settings()); this.service = service; @@ -104,7 +104,7 @@ public class AzureBlobStore implements BlobStore { return service.getInputStream(clientName, container, blob); } - public Map listBlobsByPrefix(String keyPath, String prefix) + public Map listBlobsByPrefix(String keyPath, String prefix) throws URISyntaxException, StorageException, IOException { return service.listBlobsByPrefix(clientName, container, keyPath, prefix); } diff --git a/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureRepository.java b/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureRepository.java index e07ffedb444..9384b72eb6c 100644 --- a/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureRepository.java +++ b/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureRepository.java @@ -23,7 +23,7 @@ import com.microsoft.azure.storage.LocationMode; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.Strings; import org.elasticsearch.common.blobstore.BlobPath; @@ -78,7 +78,7 @@ public class AzureRepository extends BlobStoreRepository { private final boolean readonly; public AzureRepository( - final RepositoryMetaData metadata, + final RepositoryMetadata metadata, final NamedXContentRegistry namedXContentRegistry, final AzureStorageService storageService, final ClusterService clusterService) { diff --git a/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureStorageService.java b/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureStorageService.java index ca7cb3475b4..5fa4810ea9a 100644 --- a/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureStorageService.java +++ b/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureStorageService.java @@ -43,10 +43,10 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.action.support.PlainActionFuture; -import org.elasticsearch.common.blobstore.BlobMetaData; +import org.elasticsearch.common.blobstore.BlobMetadata; import org.elasticsearch.common.blobstore.BlobPath; import org.elasticsearch.common.blobstore.DeleteResult; -import org.elasticsearch.common.blobstore.support.PlainBlobMetaData; +import org.elasticsearch.common.blobstore.support.PlainBlobMetadata; import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.settings.Settings; @@ -267,12 +267,12 @@ public class AzureStorageService { return giveSocketPermissionsToStream(is); } - public Map listBlobsByPrefix(String account, String container, String keyPath, String prefix) + public Map listBlobsByPrefix(String account, String container, String keyPath, String prefix) throws URISyntaxException, StorageException, IOException { // NOTE: this should be here: if (prefix == null) prefix = ""; // however, this is really inefficient since deleteBlobsByPrefix enumerates everything and // then does a prefix match on the result; it should just call listBlobsByPrefix with the prefix! - final MapBuilder blobsBuilder = MapBuilder.newMapBuilder(); + final MapBuilder blobsBuilder = MapBuilder.newMapBuilder(); final EnumSet enumBlobListingDetails = EnumSet.of(BlobListingDetails.METADATA); final Tuple> client = client(account); final CloudBlobContainer blobContainer = client.v1().getContainerReference(container); @@ -289,7 +289,7 @@ public class AzureStorageService { final BlobProperties properties = ((CloudBlob) blobItem).getProperties(); final String name = blobPath.substring(keyPath.length()); logger.trace(() -> new ParameterizedMessage("blob url [{}], name [{}], size [{}]", uri, name, properties.getLength())); - blobsBuilder.put(name, new PlainBlobMetaData(name, properties.getLength())); + blobsBuilder.put(name, new PlainBlobMetadata(name, properties.getLength())); } } }); diff --git a/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureBlobContainerRetriesTests.java b/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureBlobContainerRetriesTests.java index ce3cba065c3..3ec5d394392 100644 --- a/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureBlobContainerRetriesTests.java +++ b/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureBlobContainerRetriesTests.java @@ -25,7 +25,7 @@ import com.microsoft.azure.storage.blob.BlobRequestOptions; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpServer; import fixture.azure.AzureHttpHandler; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.common.Strings; import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.blobstore.BlobContainer; @@ -139,13 +139,13 @@ public class AzureBlobContainerRetriesTests extends ESTestCase { } }; - final RepositoryMetaData repositoryMetaData = new RepositoryMetaData("repository", AzureRepository.TYPE, + final RepositoryMetadata repositoryMetadata = new RepositoryMetadata("repository", AzureRepository.TYPE, Settings.builder() .put(CONTAINER_SETTING.getKey(), "container") .put(ACCOUNT_SETTING.getKey(), clientName) .build()); - return new AzureBlobContainer(BlobPath.cleanPath(), new AzureBlobStore(repositoryMetaData, service, threadPool), threadPool); + return new AzureBlobContainer(BlobPath.cleanPath(), new AzureBlobStore(repositoryMetadata, service, threadPool), threadPool); } public void testReadNonexistentBlobThrowsNoSuchFileException() { diff --git a/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureRepositorySettingsTests.java b/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureRepositorySettingsTests.java index 6f5373dab98..259fb6ee8f1 100644 --- a/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureRepositorySettingsTests.java +++ b/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureRepositorySettingsTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.repositories.azure; import com.microsoft.azure.storage.LocationMode; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; @@ -41,7 +41,7 @@ public class AzureRepositorySettingsTests extends ESTestCase { .putList(Environment.PATH_DATA_SETTING.getKey(), tmpPaths()) .put(settings) .build(); - final AzureRepository azureRepository = new AzureRepository(new RepositoryMetaData("foo", "azure", internalSettings), + final AzureRepository azureRepository = new AzureRepository(new RepositoryMetadata("foo", "azure", internalSettings), NamedXContentRegistry.EMPTY, mock(AzureStorageService.class), BlobStoreTestUtil.mockClusterService()); assertThat(azureRepository.getBlobStore(), is(nullValue())); return azureRepository; diff --git a/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageBlobContainer.java b/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageBlobContainer.java index 7a386dd1b39..44aa697ffe9 100644 --- a/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageBlobContainer.java +++ b/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageBlobContainer.java @@ -20,7 +20,7 @@ package org.elasticsearch.repositories.gcs; import org.elasticsearch.common.blobstore.BlobContainer; -import org.elasticsearch.common.blobstore.BlobMetaData; +import org.elasticsearch.common.blobstore.BlobMetadata; import org.elasticsearch.common.blobstore.BlobPath; import org.elasticsearch.common.blobstore.DeleteResult; import org.elasticsearch.common.blobstore.support.AbstractBlobContainer; @@ -43,7 +43,7 @@ class GoogleCloudStorageBlobContainer extends AbstractBlobContainer { } @Override - public Map listBlobs() throws IOException { + public Map listBlobs() throws IOException { return blobStore.listBlobs(path); } @@ -53,7 +53,7 @@ class GoogleCloudStorageBlobContainer extends AbstractBlobContainer { } @Override - public Map listBlobsByPrefix(String prefix) throws IOException { + public Map listBlobsByPrefix(String prefix) throws IOException { return blobStore.listBlobsByPrefix(path, prefix); } diff --git a/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageBlobStore.java b/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageBlobStore.java index e15ffaa1c78..013ff42feda 100644 --- a/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageBlobStore.java +++ b/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageBlobStore.java @@ -34,12 +34,12 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.common.blobstore.BlobContainer; -import org.elasticsearch.common.blobstore.BlobMetaData; +import org.elasticsearch.common.blobstore.BlobMetadata; import org.elasticsearch.common.blobstore.BlobPath; import org.elasticsearch.common.blobstore.BlobStore; import org.elasticsearch.common.blobstore.BlobStoreException; import org.elasticsearch.common.blobstore.DeleteResult; -import org.elasticsearch.common.blobstore.support.PlainBlobMetaData; +import org.elasticsearch.common.blobstore.support.PlainBlobMetadata; import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.core.internal.io.Streams; @@ -117,7 +117,7 @@ class GoogleCloudStorageBlobStore implements BlobStore { * @param path base path of the blobs to list * @return a map of blob names and their metadata */ - Map listBlobs(String path) throws IOException { + Map listBlobs(String path) throws IOException { return listBlobsByPrefix(path, ""); } @@ -130,16 +130,16 @@ class GoogleCloudStorageBlobStore implements BlobStore { * @param prefix prefix of the blobs to list. * @return a map of blob names and their metadata. */ - Map listBlobsByPrefix(String path, String prefix) throws IOException { + Map listBlobsByPrefix(String path, String prefix) throws IOException { final String pathPrefix = buildKey(path, prefix); - final MapBuilder mapBuilder = MapBuilder.newMapBuilder(); + final MapBuilder mapBuilder = MapBuilder.newMapBuilder(); SocketAccess.doPrivilegedVoidIOException( () -> client().get(bucketName).list(BlobListOption.currentDirectory(), BlobListOption.prefix(pathPrefix)).iterateAll().forEach( blob -> { assert blob.getName().startsWith(path); if (blob.isDirectory() == false) { final String suffixName = blob.getName().substring(path.length()); - mapBuilder.put(suffixName, new PlainBlobMetaData(suffixName, blob.getSize())); + mapBuilder.put(suffixName, new PlainBlobMetadata(suffixName, blob.getSize())); } })); return mapBuilder.immutableMap(); diff --git a/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageRepository.java b/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageRepository.java index 5cfcb0c4920..4d1a71c3ec3 100644 --- a/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageRepository.java +++ b/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageRepository.java @@ -21,7 +21,7 @@ package org.elasticsearch.repositories.gcs; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.Strings; import org.elasticsearch.common.blobstore.BlobPath; @@ -65,7 +65,7 @@ class GoogleCloudStorageRepository extends BlobStoreRepository { private final String clientName; GoogleCloudStorageRepository( - final RepositoryMetaData metadata, + final RepositoryMetadata metadata, final NamedXContentRegistry namedXContentRegistry, final GoogleCloudStorageService storageService, final ClusterService clusterService) { @@ -107,7 +107,7 @@ class GoogleCloudStorageRepository extends BlobStoreRepository { /** * Get a given setting from the repository settings, throwing a {@link RepositoryException} if the setting does not exist or is empty. */ - static T getSetting(Setting setting, RepositoryMetaData metadata) { + static T getSetting(Setting setting, RepositoryMetadata metadata) { T value = setting.get(metadata.settings()); if (value == null) { throw new RepositoryException(metadata.name(), "Setting [" + setting.getKey() + "] is not defined for repository"); diff --git a/plugins/repository-gcs/src/test/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageBlobStoreRepositoryTests.java b/plugins/repository-gcs/src/test/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageBlobStoreRepositoryTests.java index 971d77edcd2..df028e2d9f5 100644 --- a/plugins/repository-gcs/src/test/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageBlobStoreRepositoryTests.java +++ b/plugins/repository-gcs/src/test/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageBlobStoreRepositoryTests.java @@ -31,7 +31,7 @@ import org.apache.lucene.util.BytesRefBuilder; import org.elasticsearch.action.ActionRunnable; import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.bootstrap.JavaVersion; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.blobstore.BlobContainer; @@ -134,38 +134,38 @@ public class GoogleCloudStorageBlobStoreRepositoryTests extends ESMockAPIBasedRe public void testChunkSize() { // default chunk size - RepositoryMetaData repositoryMetaData = new RepositoryMetaData("repo", GoogleCloudStorageRepository.TYPE, Settings.EMPTY); - ByteSizeValue chunkSize = GoogleCloudStorageRepository.getSetting(GoogleCloudStorageRepository.CHUNK_SIZE, repositoryMetaData); + RepositoryMetadata repositoryMetadata = new RepositoryMetadata("repo", GoogleCloudStorageRepository.TYPE, Settings.EMPTY); + ByteSizeValue chunkSize = GoogleCloudStorageRepository.getSetting(GoogleCloudStorageRepository.CHUNK_SIZE, repositoryMetadata); assertEquals(GoogleCloudStorageRepository.MAX_CHUNK_SIZE, chunkSize); // chunk size in settings final int size = randomIntBetween(1, 100); - repositoryMetaData = new RepositoryMetaData("repo", GoogleCloudStorageRepository.TYPE, + repositoryMetadata = new RepositoryMetadata("repo", GoogleCloudStorageRepository.TYPE, Settings.builder().put("chunk_size", size + "mb").build()); - chunkSize = GoogleCloudStorageRepository.getSetting(GoogleCloudStorageRepository.CHUNK_SIZE, repositoryMetaData); + chunkSize = GoogleCloudStorageRepository.getSetting(GoogleCloudStorageRepository.CHUNK_SIZE, repositoryMetadata); assertEquals(new ByteSizeValue(size, ByteSizeUnit.MB), chunkSize); // zero bytes is not allowed IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> { - final RepositoryMetaData repoMetaData = new RepositoryMetaData("repo", GoogleCloudStorageRepository.TYPE, + final RepositoryMetadata repoMetadata = new RepositoryMetadata("repo", GoogleCloudStorageRepository.TYPE, Settings.builder().put("chunk_size", "0").build()); - GoogleCloudStorageRepository.getSetting(GoogleCloudStorageRepository.CHUNK_SIZE, repoMetaData); + GoogleCloudStorageRepository.getSetting(GoogleCloudStorageRepository.CHUNK_SIZE, repoMetadata); }); assertEquals("failed to parse value [0] for setting [chunk_size], must be >= [1b]", e.getMessage()); // negative bytes not allowed e = expectThrows(IllegalArgumentException.class, () -> { - final RepositoryMetaData repoMetaData = new RepositoryMetaData("repo", GoogleCloudStorageRepository.TYPE, + final RepositoryMetadata repoMetadata = new RepositoryMetadata("repo", GoogleCloudStorageRepository.TYPE, Settings.builder().put("chunk_size", "-1").build()); - GoogleCloudStorageRepository.getSetting(GoogleCloudStorageRepository.CHUNK_SIZE, repoMetaData); + GoogleCloudStorageRepository.getSetting(GoogleCloudStorageRepository.CHUNK_SIZE, repoMetadata); }); assertEquals("failed to parse value [-1] for setting [chunk_size], must be >= [1b]", e.getMessage()); // greater than max chunk size not allowed e = expectThrows(IllegalArgumentException.class, () -> { - final RepositoryMetaData repoMetaData = new RepositoryMetaData("repo", GoogleCloudStorageRepository.TYPE, + final RepositoryMetadata repoMetadata = new RepositoryMetadata("repo", GoogleCloudStorageRepository.TYPE, Settings.builder().put("chunk_size", "101mb").build()); - GoogleCloudStorageRepository.getSetting(GoogleCloudStorageRepository.CHUNK_SIZE, repoMetaData); + GoogleCloudStorageRepository.getSetting(GoogleCloudStorageRepository.CHUNK_SIZE, repoMetadata); }); assertEquals("failed to parse value [101mb] for setting [chunk_size], must be <= [100mb]", e.getMessage()); } diff --git a/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsBlobContainer.java b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsBlobContainer.java index 832c9db7dbf..c751c5fde9a 100644 --- a/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsBlobContainer.java +++ b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsBlobContainer.java @@ -26,12 +26,12 @@ import org.apache.hadoop.fs.Options.CreateOpts; import org.apache.hadoop.fs.Path; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.blobstore.BlobContainer; -import org.elasticsearch.common.blobstore.BlobMetaData; +import org.elasticsearch.common.blobstore.BlobMetadata; import org.elasticsearch.common.blobstore.BlobPath; import org.elasticsearch.common.blobstore.DeleteResult; import org.elasticsearch.common.blobstore.fs.FsBlobContainer; import org.elasticsearch.common.blobstore.support.AbstractBlobContainer; -import org.elasticsearch.common.blobstore.support.PlainBlobMetaData; +import org.elasticsearch.common.blobstore.support.PlainBlobMetadata; import org.elasticsearch.repositories.hdfs.HdfsBlobStore.Operation; import java.io.FileNotFoundException; @@ -149,20 +149,20 @@ final class HdfsBlobContainer extends AbstractBlobContainer { } @Override - public Map listBlobsByPrefix(@Nullable final String prefix) throws IOException { + public Map listBlobsByPrefix(@Nullable final String prefix) throws IOException { FileStatus[] files = store.execute(fileContext -> fileContext.util().listStatus(path, path -> prefix == null || path.getName().startsWith(prefix))); - Map map = new LinkedHashMap<>(); + Map map = new LinkedHashMap<>(); for (FileStatus file : files) { if (file.isFile()) { - map.put(file.getPath().getName(), new PlainBlobMetaData(file.getPath().getName(), file.getLen())); + map.put(file.getPath().getName(), new PlainBlobMetadata(file.getPath().getName(), file.getLen())); } } return Collections.unmodifiableMap(map); } @Override - public Map listBlobs() throws IOException { + public Map listBlobs() throws IOException { return listBlobsByPrefix(null); } diff --git a/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsRepository.java b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsRepository.java index 0f068aa1752..9b41c20030b 100644 --- a/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsRepository.java +++ b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsRepository.java @@ -30,7 +30,7 @@ import org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.elasticsearch.SpecialPermission; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.Strings; import org.elasticsearch.common.SuppressForbidden; @@ -68,7 +68,7 @@ public final class HdfsRepository extends BlobStoreRepository { private static final ByteSizeValue DEFAULT_BUFFER_SIZE = new ByteSizeValue(100, ByteSizeUnit.KB); public HdfsRepository( - final RepositoryMetaData metadata, + final RepositoryMetadata metadata, final Environment environment, final NamedXContentRegistry namedXContentRegistry, final ClusterService clusterService) { diff --git a/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java b/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java index 96eae1bd53f..bd872a15eed 100644 --- a/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java +++ b/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java @@ -147,8 +147,8 @@ public class HdfsTests extends ESSingleNodeTestCase { ensureGreen(); assertThat(count(client, "test-idx-1"), equalTo(100L)); ClusterState clusterState = client.admin().cluster().prepareState().get().getState(); - assertThat(clusterState.getMetaData().hasIndex("test-idx-1"), equalTo(true)); - assertThat(clusterState.getMetaData().hasIndex("test-idx-2"), equalTo(false)); + assertThat(clusterState.getMetadata().hasIndex("test-idx-1"), equalTo(true)); + assertThat(clusterState.getMetadata().hasIndex("test-idx-2"), equalTo(false)); final BlobStoreRepository repo = (BlobStoreRepository) getInstanceFromNode(RepositoriesService.class).repository("test-repo"); BlobStoreTestUtil.assertConsistency(repo, repo.threadPool().executor(ThreadPool.Names.GENERIC)); diff --git a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3BlobContainer.java b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3BlobContainer.java index 9cb118d6008..94cf9a624f1 100644 --- a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3BlobContainer.java +++ b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3BlobContainer.java @@ -40,11 +40,11 @@ import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Strings; import org.elasticsearch.common.blobstore.BlobContainer; -import org.elasticsearch.common.blobstore.BlobMetaData; +import org.elasticsearch.common.blobstore.BlobMetadata; import org.elasticsearch.common.blobstore.BlobPath; import org.elasticsearch.common.blobstore.DeleteResult; import org.elasticsearch.common.blobstore.support.AbstractBlobContainer; -import org.elasticsearch.common.blobstore.support.PlainBlobMetaData; +import org.elasticsearch.common.blobstore.support.PlainBlobMetadata; import org.elasticsearch.common.collect.Tuple; import java.io.IOException; @@ -220,20 +220,20 @@ class S3BlobContainer extends AbstractBlobContainer { } @Override - public Map listBlobsByPrefix(@Nullable String blobNamePrefix) throws IOException { + public Map listBlobsByPrefix(@Nullable String blobNamePrefix) throws IOException { try (AmazonS3Reference clientReference = blobStore.clientReference()) { return executeListing(clientReference, listObjectsRequest(blobNamePrefix == null ? keyPath : buildKey(blobNamePrefix))) .stream() .flatMap(listing -> listing.getObjectSummaries().stream()) - .map(summary -> new PlainBlobMetaData(summary.getKey().substring(keyPath.length()), summary.getSize())) - .collect(Collectors.toMap(PlainBlobMetaData::name, Function.identity())); + .map(summary -> new PlainBlobMetadata(summary.getKey().substring(keyPath.length()), summary.getSize())) + .collect(Collectors.toMap(PlainBlobMetadata::name, Function.identity())); } catch (final AmazonClientException e) { throw new IOException("Exception when listing blobs by prefix [" + blobNamePrefix + "]", e); } } @Override - public Map listBlobs() throws IOException { + public Map listBlobs() throws IOException { return listBlobsByPrefix(null); } diff --git a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3BlobStore.java b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3BlobStore.java index a8cb87a5526..101925d96d8 100644 --- a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3BlobStore.java +++ b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3BlobStore.java @@ -21,7 +21,7 @@ package org.elasticsearch.repositories.s3; import com.amazonaws.services.s3.model.CannedAccessControlList; import com.amazonaws.services.s3.model.StorageClass; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.common.blobstore.BlobContainer; import org.elasticsearch.common.blobstore.BlobPath; import org.elasticsearch.common.blobstore.BlobStore; @@ -45,18 +45,18 @@ class S3BlobStore implements BlobStore { private final StorageClass storageClass; - private final RepositoryMetaData repositoryMetaData; + private final RepositoryMetadata repositoryMetadata; S3BlobStore(S3Service service, String bucket, boolean serverSideEncryption, ByteSizeValue bufferSize, String cannedACL, String storageClass, - RepositoryMetaData repositoryMetaData) { + RepositoryMetadata repositoryMetadata) { this.service = service; this.bucket = bucket; this.serverSideEncryption = serverSideEncryption; this.bufferSize = bufferSize; this.cannedACL = initCannedACL(cannedACL); this.storageClass = initStorageClass(storageClass); - this.repositoryMetaData = repositoryMetaData; + this.repositoryMetadata = repositoryMetadata; } @Override @@ -65,11 +65,11 @@ class S3BlobStore implements BlobStore { } public AmazonS3Reference clientReference() { - return service.client(repositoryMetaData); + return service.client(repositoryMetadata); } int getMaxRetries() { - return service.settings(repositoryMetaData).maxRetries; + return service.settings(repositoryMetadata).maxRetries; } public String bucket() { diff --git a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3ClientSettings.java b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3ClientSettings.java index e786f1b9274..183be65ffc2 100644 --- a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3ClientSettings.java +++ b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3ClientSettings.java @@ -21,7 +21,7 @@ package org.elasticsearch.repositories.s3; import com.amazonaws.ClientConfiguration; import com.amazonaws.Protocol; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.common.settings.SecureSetting; import org.elasticsearch.common.settings.SecureString; import org.elasticsearch.common.settings.Setting; @@ -179,10 +179,10 @@ final class S3ClientSettings { /** * Overrides the settings in this instance with settings found in repository metadata. * - * @param metadata RepositoryMetaData + * @param metadata RepositoryMetadata * @return S3ClientSettings */ - S3ClientSettings refine(RepositoryMetaData metadata) { + S3ClientSettings refine(RepositoryMetadata metadata) { final Settings repoSettings = metadata.settings(); // Normalize settings to placeholder client settings prefix so that we can use the affix settings directly final Settings normalizedSettings = diff --git a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Repository.java b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Repository.java index 1bbca19ae0b..cbaca8a05ff 100644 --- a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Repository.java +++ b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Repository.java @@ -24,8 +24,8 @@ import org.apache.logging.log4j.Logger; import org.elasticsearch.Version; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionRunnable; -import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.Metadata; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.Strings; import org.elasticsearch.common.blobstore.BlobPath; @@ -196,7 +196,7 @@ class S3Repository extends BlobStoreRepository { private final String cannedACL; - private final RepositoryMetaData repositoryMetaData; + private final RepositoryMetadata repositoryMetadata; /** * Time period to delay repository operations by after finalizing or deleting a snapshot. @@ -208,14 +208,14 @@ class S3Repository extends BlobStoreRepository { * Constructs an s3 backed repository */ S3Repository( - final RepositoryMetaData metadata, + final RepositoryMetadata metadata, final NamedXContentRegistry namedXContentRegistry, final S3Service service, final ClusterService clusterService) { super(metadata, COMPRESS_SETTING.get(metadata.settings()), namedXContentRegistry, clusterService); this.service = service; - this.repositoryMetaData = metadata; + this.repositoryMetadata = metadata; // Parse and validate the user's S3 Storage Class setting this.bucket = BUCKET_SETTING.get(metadata.settings()); @@ -271,13 +271,13 @@ class S3Repository extends BlobStoreRepository { @Override public void finalizeSnapshot(SnapshotId snapshotId, ShardGenerations shardGenerations, long startTime, String failure, int totalShards, List shardFailures, long repositoryStateId, boolean includeGlobalState, - MetaData clusterMetaData, Map userMetadata, Version repositoryMetaVersion, + Metadata clusterMetadata, Map userMetadata, Version repositoryMetaVersion, ActionListener listener) { if (SnapshotsService.useShardGenerations(repositoryMetaVersion) == false) { listener = delayedListener(listener); } super.finalizeSnapshot(snapshotId, shardGenerations, startTime, failure, totalShards, shardFailures, repositoryStateId, - includeGlobalState, clusterMetaData, userMetadata, repositoryMetaVersion, listener); + includeGlobalState, clusterMetadata, userMetadata, repositoryMetaVersion, listener); } @Override @@ -329,7 +329,7 @@ class S3Repository extends BlobStoreRepository { @Override protected S3BlobStore createBlobStore() { - return new S3BlobStore(service, bucket, serverSideEncryption, bufferSize, cannedACL, storageClass, repositoryMetaData); + return new S3BlobStore(service, bucket, serverSideEncryption, bufferSize, cannedACL, storageClass, repositoryMetadata); } // only use for testing diff --git a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3RepositoryPlugin.java b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3RepositoryPlugin.java index e97114d3ebc..581aabfd650 100644 --- a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3RepositoryPlugin.java +++ b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3RepositoryPlugin.java @@ -21,7 +21,7 @@ package org.elasticsearch.repositories.s3; import com.amazonaws.util.json.Jackson; import org.elasticsearch.SpecialPermission; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; @@ -77,7 +77,7 @@ public class S3RepositoryPlugin extends Plugin implements RepositoryPlugin, Relo // proxy method for testing protected S3Repository createRepository( - final RepositoryMetaData metadata, + final RepositoryMetadata metadata, final NamedXContentRegistry registry, final ClusterService clusterService) { return new S3Repository(metadata, registry, service, clusterService); diff --git a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Service.java b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Service.java index 5d0df8e0c8c..9ad2be4e783 100644 --- a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Service.java +++ b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Service.java @@ -32,7 +32,7 @@ import com.amazonaws.services.s3.internal.Constants; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.common.Strings; import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; @@ -56,9 +56,9 @@ class S3Service implements Closeable { /** * Client settings derived from those in {@link #staticClientSettings} by combining them with settings - * in the {@link RepositoryMetaData}. + * in the {@link RepositoryMetadata}. */ - private volatile Map> derivedClientSettings = emptyMap(); + private volatile Map> derivedClientSettings = emptyMap(); /** * Refreshes the settings for the AmazonS3 clients and clears the cache of @@ -80,8 +80,8 @@ class S3Service implements Closeable { * Attempts to retrieve a client by its repository metadata and settings from the cache. * If the client does not exist it will be created. */ - public AmazonS3Reference client(RepositoryMetaData repositoryMetaData) { - final S3ClientSettings clientSettings = settings(repositoryMetaData); + public AmazonS3Reference client(RepositoryMetadata repositoryMetadata) { + final S3ClientSettings clientSettings = settings(repositoryMetadata); { final AmazonS3Reference clientReference = clientsCache.get(clientSettings); if (clientReference != null && clientReference.tryIncRef()) { @@ -101,31 +101,31 @@ class S3Service implements Closeable { } /** - * Either fetches {@link S3ClientSettings} for a given {@link RepositoryMetaData} from cached settings or creates them + * Either fetches {@link S3ClientSettings} for a given {@link RepositoryMetadata} from cached settings or creates them * by overriding static client settings from {@link #staticClientSettings} with settings found in the repository metadata. - * @param repositoryMetaData Repository Metadata + * @param repositoryMetadata Repository Metadata * @return S3ClientSettings */ - S3ClientSettings settings(RepositoryMetaData repositoryMetaData) { - final String clientName = S3Repository.CLIENT_NAME.get(repositoryMetaData.settings()); + S3ClientSettings settings(RepositoryMetadata repositoryMetadata) { + final String clientName = S3Repository.CLIENT_NAME.get(repositoryMetadata.settings()); final S3ClientSettings staticSettings = staticClientSettings.get(clientName); if (staticSettings != null) { { - final S3ClientSettings existing = derivedClientSettings.getOrDefault(staticSettings, emptyMap()).get(repositoryMetaData); + final S3ClientSettings existing = derivedClientSettings.getOrDefault(staticSettings, emptyMap()).get(repositoryMetadata); if (existing != null) { return existing; } } synchronized (this) { - final Map derivedSettings = + final Map derivedSettings = derivedClientSettings.getOrDefault(staticSettings, emptyMap()); - final S3ClientSettings existing = derivedSettings.get(repositoryMetaData); + final S3ClientSettings existing = derivedSettings.get(repositoryMetadata); if (existing != null) { return existing; } - final S3ClientSettings newSettings = staticSettings.refine(repositoryMetaData); + final S3ClientSettings newSettings = staticSettings.refine(repositoryMetadata); derivedClientSettings = MapBuilder.newMapBuilder(derivedClientSettings).put( - staticSettings, MapBuilder.newMapBuilder(derivedSettings).put(repositoryMetaData, newSettings).immutableMap() + staticSettings, MapBuilder.newMapBuilder(derivedSettings).put(repositoryMetadata, newSettings).immutableMap() ).immutableMap(); return newSettings; } diff --git a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/RepositoryCredentialsTests.java b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/RepositoryCredentialsTests.java index a063c2f1c1f..a4402558c92 100644 --- a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/RepositoryCredentialsTests.java +++ b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/RepositoryCredentialsTests.java @@ -25,7 +25,7 @@ import com.amazonaws.services.s3.AmazonS3; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.settings.MockSecureSettings; @@ -267,7 +267,7 @@ public class RepositoryCredentialsTests extends ESSingleNodeTestCase { } @Override - protected S3Repository createRepository(RepositoryMetaData metadata, + protected S3Repository createRepository(RepositoryMetadata metadata, NamedXContentRegistry registry, ClusterService clusterService) { return new S3Repository(metadata, registry, service, clusterService) { @Override diff --git a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3BlobContainerRetriesTests.java b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3BlobContainerRetriesTests.java index a8affd31aa8..9c26576be7d 100644 --- a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3BlobContainerRetriesTests.java +++ b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3BlobContainerRetriesTests.java @@ -26,7 +26,7 @@ import com.sun.net.httpserver.HttpServer; import org.apache.http.ConnectionClosedException; import org.apache.http.HttpStatus; import org.apache.http.NoHttpResponseException; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.blobstore.BlobContainer; @@ -126,7 +126,7 @@ public class S3BlobContainerRetriesTests extends ESTestCase { clientSettings.setSecureSettings(secureSettings); service.refreshAndClearCache(S3ClientSettings.load(clientSettings.build())); - final RepositoryMetaData repositoryMetaData = new RepositoryMetaData("repository", S3Repository.TYPE, + final RepositoryMetadata repositoryMetadata = new RepositoryMetadata("repository", S3Repository.TYPE, Settings.builder().put(S3Repository.CLIENT_NAME.getKey(), clientName).build()); return new S3BlobContainer(BlobPath.cleanPath(), new S3BlobStore(service, "bucket", @@ -134,7 +134,7 @@ public class S3BlobContainerRetriesTests extends ESTestCase { bufferSize == null ? S3Repository.BUFFER_SIZE_SETTING.getDefault(Settings.EMPTY) : bufferSize, S3Repository.CANNED_ACL_SETTING.getDefault(Settings.EMPTY), S3Repository.STORAGE_CLASS_SETTING.getDefault(Settings.EMPTY), - repositoryMetaData)); + repositoryMetadata)); } public void testReadNonexistentBlobThrowsNoSuchFileException() { diff --git a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3BlobStoreRepositoryTests.java b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3BlobStoreRepositoryTests.java index c28f6fbb66e..ab04fd2d453 100644 --- a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3BlobStoreRepositoryTests.java +++ b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3BlobStoreRepositoryTests.java @@ -24,7 +24,7 @@ import com.sun.net.httpserver.HttpHandler; import fixture.s3.S3HttpHandler; import org.elasticsearch.action.ActionRunnable; import org.elasticsearch.action.support.PlainActionFuture; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.blobstore.BlobContainer; @@ -193,7 +193,7 @@ public class S3BlobStoreRepositoryTests extends ESMockAPIBasedRepositoryIntegTes } @Override - protected S3Repository createRepository(RepositoryMetaData metadata, NamedXContentRegistry registry, + protected S3Repository createRepository(RepositoryMetadata metadata, NamedXContentRegistry registry, ClusterService clusterService) { return new S3Repository(metadata, registry, service, clusterService) { diff --git a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3ClientSettingsTests.java b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3ClientSettingsTests.java index c0da7de3444..7deb958465e 100644 --- a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3ClientSettingsTests.java +++ b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3ClientSettingsTests.java @@ -22,7 +22,7 @@ package org.elasticsearch.repositories.s3; import com.amazonaws.ClientConfiguration; import com.amazonaws.Protocol; import com.amazonaws.services.s3.AmazonS3Client; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.common.settings.MockSecureSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESTestCase; @@ -130,13 +130,13 @@ public class S3ClientSettingsTests extends ESTestCase { Settings.builder().setSecureSettings(secureSettings).build()).get("default"); { - final S3ClientSettings refinedSettings = baseSettings.refine(new RepositoryMetaData("name", "type", Settings.EMPTY)); + final S3ClientSettings refinedSettings = baseSettings.refine(new RepositoryMetadata("name", "type", Settings.EMPTY)); assertTrue(refinedSettings == baseSettings); } { final String endpoint = "some.host"; - final S3ClientSettings refinedSettings = baseSettings.refine(new RepositoryMetaData("name", "type", + final S3ClientSettings refinedSettings = baseSettings.refine(new RepositoryMetadata("name", "type", Settings.builder().put("endpoint", endpoint).build())); assertThat(refinedSettings.endpoint, is(endpoint)); S3BasicSessionCredentials credentials = (S3BasicSessionCredentials) refinedSettings.credentials; diff --git a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3RepositoryTests.java b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3RepositoryTests.java index 3466fd89ebb..ea8500c0738 100644 --- a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3RepositoryTests.java +++ b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3RepositoryTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.repositories.s3; import com.amazonaws.services.s3.AbstractAmazonS3; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; @@ -49,7 +49,7 @@ public class S3RepositoryTests extends ESTestCase { private static class DummyS3Service extends S3Service { @Override - public AmazonS3Reference client(RepositoryMetaData repositoryMetaData) { + public AmazonS3Reference client(RepositoryMetadata repositoryMetadata) { return new AmazonS3Reference(new DummyS3Client()); } @@ -66,23 +66,23 @@ public class S3RepositoryTests extends ESTestCase { // chunk < buffer should fail final Settings s1 = bufferAndChunkSettings(10, 5); final Exception e1 = expectThrows(RepositoryException.class, - () -> createS3Repo(getRepositoryMetaData(s1))); + () -> createS3Repo(getRepositoryMetadata(s1))); assertThat(e1.getMessage(), containsString("chunk_size (5mb) can't be lower than buffer_size (10mb)")); // chunk > buffer should pass final Settings s2 = bufferAndChunkSettings(5, 10); - createS3Repo(getRepositoryMetaData(s2)).close(); + createS3Repo(getRepositoryMetadata(s2)).close(); // chunk = buffer should pass final Settings s3 = bufferAndChunkSettings(5, 5); - createS3Repo(getRepositoryMetaData(s3)).close(); + createS3Repo(getRepositoryMetadata(s3)).close(); // buffer < 5mb should fail final Settings s4 = bufferAndChunkSettings(4, 10); final IllegalArgumentException e2 = expectThrows(IllegalArgumentException.class, - () -> createS3Repo(getRepositoryMetaData(s4)) + () -> createS3Repo(getRepositoryMetadata(s4)) .close()); assertThat(e2.getMessage(), containsString("failed to parse value [4mb] for setting [buffer_size], must be >= [5mb]")); final Settings s5 = bufferAndChunkSettings(5, 6000000); final IllegalArgumentException e3 = expectThrows(IllegalArgumentException.class, - () -> createS3Repo(getRepositoryMetaData(s5)) + () -> createS3Repo(getRepositoryMetadata(s5)) .close()); assertThat(e3.getMessage(), containsString("failed to parse value [6000000mb] for setting [chunk_size], must be <= [5tb]")); } @@ -94,12 +94,12 @@ public class S3RepositoryTests extends ESTestCase { .build(); } - private RepositoryMetaData getRepositoryMetaData(Settings settings) { - return new RepositoryMetaData("dummy-repo", "mock", Settings.builder().put(settings).build()); + private RepositoryMetadata getRepositoryMetadata(Settings settings) { + return new RepositoryMetadata("dummy-repo", "mock", Settings.builder().put(settings).build()); } public void testBasePathSetting() { - final RepositoryMetaData metadata = new RepositoryMetaData("dummy-repo", "mock", Settings.builder() + final RepositoryMetadata metadata = new RepositoryMetadata("dummy-repo", "mock", Settings.builder() .put(S3Repository.BASE_PATH_SETTING.getKey(), "foo/bar").build()); try (S3Repository s3repo = createS3Repo(metadata)) { assertEquals("foo/bar/", s3repo.basePath().buildAsString()); @@ -107,7 +107,7 @@ public class S3RepositoryTests extends ESTestCase { } public void testDefaultBufferSize() { - final RepositoryMetaData metadata = new RepositoryMetaData("dummy-repo", "mock", Settings.EMPTY); + final RepositoryMetadata metadata = new RepositoryMetadata("dummy-repo", "mock", Settings.EMPTY); try (S3Repository s3repo = createS3Repo(metadata)) { assertThat(s3repo.getBlobStore(), is(nullValue())); s3repo.start(); @@ -118,7 +118,7 @@ public class S3RepositoryTests extends ESTestCase { } } - private S3Repository createS3Repo(RepositoryMetaData metadata) { + private S3Repository createS3Repo(RepositoryMetadata metadata) { return new S3Repository(metadata, NamedXContentRegistry.EMPTY, new DummyS3Service(), BlobStoreTestUtil.mockClusterService()) { @Override protected void assertSnapshotOrGenericThread() { diff --git a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3RepositoryThirdPartyTests.java b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3RepositoryThirdPartyTests.java index 1f0fcc2a97b..47ec86a4b9c 100644 --- a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3RepositoryThirdPartyTests.java +++ b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/S3RepositoryThirdPartyTests.java @@ -19,7 +19,7 @@ package org.elasticsearch.repositories.s3; import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.common.blobstore.BlobMetaData; +import org.elasticsearch.common.blobstore.BlobMetadata; import org.elasticsearch.common.blobstore.BlobPath; import org.elasticsearch.common.settings.MockSecureSettings; import org.elasticsearch.common.settings.SecureSettings; @@ -94,7 +94,7 @@ public class S3RepositoryThirdPartyTests extends AbstractThirdPartyRepositoryTes assertBusy(() -> super.assertConsistentRepository(repo, executor), 10L, TimeUnit.MINUTES); } - protected void assertBlobsByPrefix(BlobPath path, String prefix, Map blobs) throws Exception { + protected void assertBlobsByPrefix(BlobPath path, String prefix, Map blobs) throws Exception { // AWS S3 is eventually consistent so we retry for 10 minutes assuming a list operation will never take longer than that // to become consistent. assertBusy(() -> super.assertBlobsByPrefix(path, prefix, blobs), 10L, TimeUnit.MINUTES); diff --git a/qa/evil-tests/src/test/java/org/elasticsearch/cluster/metadata/EvilSystemPropertyTests.java b/qa/evil-tests/src/test/java/org/elasticsearch/cluster/metadata/EvilSystemPropertyTests.java index 5e44fdbefad..dc2e0f0bdd8 100644 --- a/qa/evil-tests/src/test/java/org/elasticsearch/cluster/metadata/EvilSystemPropertyTests.java +++ b/qa/evil-tests/src/test/java/org/elasticsearch/cluster/metadata/EvilSystemPropertyTests.java @@ -27,17 +27,17 @@ public class EvilSystemPropertyTests extends ESTestCase { @SuppressForbidden(reason = "manipulates system properties for testing") public void testMaxNumShards() { IllegalArgumentException exception = expectThrows(IllegalArgumentException.class, () -> - IndexMetaData.buildNumberOfShardsSetting() + IndexMetadata.buildNumberOfShardsSetting() .get(Settings.builder().put("index.number_of_shards", 1025).build())); assertEquals("Failed to parse value [1025] for setting [index.number_of_shards] must be <= 1024", exception.getMessage()); - Integer numShards = IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.get(Settings.builder().put("index.number_of_shards", 100).build()); + Integer numShards = IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.get(Settings.builder().put("index.number_of_shards", 100).build()); assertEquals(100, numShards.intValue()); int limit = randomIntBetween(1, 10); System.setProperty("es.index.max_number_of_shards", Integer.toString(limit)); try { IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> - IndexMetaData.buildNumberOfShardsSetting() + IndexMetadata.buildNumberOfShardsSetting() .get(Settings.builder().put("index.number_of_shards", 11).build())); assertEquals("Failed to parse value [11] for setting [index.number_of_shards] must be <= " + limit, e.getMessage()); } finally { diff --git a/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java b/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java index cd2daea3378..ffb20fcef02 100644 --- a/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java +++ b/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java @@ -26,8 +26,8 @@ import org.elasticsearch.client.Response; import org.elasticsearch.client.ResponseException; import org.elasticsearch.client.RestClient; import org.elasticsearch.client.WarningFailureException; -import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.cluster.metadata.MetaDataIndexStateService; +import org.elasticsearch.cluster.metadata.IndexMetadata; +import org.elasticsearch.cluster.metadata.MetadataIndexStateService; import org.elasticsearch.common.Booleans; import org.elasticsearch.common.CheckedFunction; import org.elasticsearch.common.Strings; @@ -700,8 +700,8 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase { if (isRunningAgainstOldCluster()) { Settings.Builder settings = Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1) // if the node with the replica is the first to be restarted, while a replica is still recovering // then delayed allocation will kick in. When the node comes back, the master will search for a copy // but the recovering copy will be seen as invalid and the cluster health won't return to GREEN @@ -1030,7 +1030,7 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase { public void testClosedIndices() throws Exception { if (isRunningAgainstOldCluster()) { createIndex(index, Settings.builder() - .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) + .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1) .build()); ensureGreen(index); @@ -1083,7 +1083,7 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase { final Map blocks = (Map) XContentMapValues.extractValue("blocks.indices." + index, state); assertThat(blocks, notNullValue()); - assertThat(blocks.containsKey(String.valueOf(MetaDataIndexStateService.INDEX_CLOSED_BLOCK_ID)), is(true)); + assertThat(blocks.containsKey(String.valueOf(MetadataIndexStateService.INDEX_CLOSED_BLOCK_ID)), is(true)); final Map settings = (Map) XContentMapValues.extractValue("settings", metadata); assertThat(settings, notNullValue()); @@ -1375,8 +1375,8 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase { public void testOperationBasedRecovery() throws Exception { if (isRunningAgainstOldCluster()) { final Settings.Builder settings = Settings.builder() - .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) - .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1); + .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1); if (getOldClusterVersion().onOrAfter(Version.V_6_7_0)) { settings.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), randomBoolean()); } @@ -1411,8 +1411,8 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase { assumeTrue("requires soft-deletes and retention leases", getOldClusterVersion().onOrAfter(Version.V_6_7_0)); if (isRunningAgainstOldCluster()) { createIndex(index, Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1) .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true).build()); ensureGreen(index); int numDocs = randomIntBetween(10, 100); diff --git a/qa/mixed-cluster/src/test/java/org/elasticsearch/backwards/IndexingIT.java b/qa/mixed-cluster/src/test/java/org/elasticsearch/backwards/IndexingIT.java index 62527908e16..6348da81b87 100644 --- a/qa/mixed-cluster/src/test/java/org/elasticsearch/backwards/IndexingIT.java +++ b/qa/mixed-cluster/src/test/java/org/elasticsearch/backwards/IndexingIT.java @@ -23,7 +23,7 @@ import org.elasticsearch.Version; import org.elasticsearch.client.Request; import org.elasticsearch.client.Response; import org.elasticsearch.client.RestClient; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.json.JsonXContent; @@ -87,8 +87,8 @@ public class IndexingIT extends ESRestTestCase { final List bwcNamesList = nodes.getBWCNodes().stream().map(Node::getNodeName).collect(Collectors.toList()); final String bwcNames = bwcNamesList.stream().collect(Collectors.joining(",")); Settings.Builder settings = Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2) + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2) .put("index.routing.allocation.include._name", bwcNames); final String index = "indexversionprop"; final int minUpdates = 5; @@ -173,8 +173,8 @@ public class IndexingIT extends ESRestTestCase { final List bwcNamesList = nodes.getBWCNodes().stream().map(Node::getNodeName).collect(Collectors.toList()); final String bwcNames = bwcNamesList.stream().collect(Collectors.joining(",")); Settings.Builder settings = Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2) + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2) .put("index.routing.allocation.include._name", bwcNames); final String index = "test"; @@ -252,8 +252,8 @@ public class IndexingIT extends ESRestTestCase { // Allocating shards on the BWC nodes to makes sure that taking snapshot happens on those nodes. Settings.Builder settings = Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), between(5, 10)) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), between(5, 10)) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1) .put("index.routing.allocation.include._name", bwcNames); final String index = "test-snapshot-index"; diff --git a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/IndexingIT.java b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/IndexingIT.java index 35a5eb64b07..3737308a754 100644 --- a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/IndexingIT.java +++ b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/IndexingIT.java @@ -23,7 +23,7 @@ import org.elasticsearch.Version; import org.elasticsearch.client.Request; import org.elasticsearch.client.Response; import org.elasticsearch.client.ResponseException; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Booleans; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; @@ -163,8 +163,8 @@ public class IndexingIT extends AbstractRollingTestCase { switch (CLUSTER_TYPE) { case OLD: Settings.Builder settings = Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 0); + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 0); createIndex(indexName, settings.build()); break; case MIXED: diff --git a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/RecoveryIT.java b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/RecoveryIT.java index 100ac982d04..0affe33a3ab 100644 --- a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/RecoveryIT.java +++ b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/RecoveryIT.java @@ -24,8 +24,8 @@ import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.client.Request; import org.elasticsearch.client.Response; import org.elasticsearch.client.ResponseException; -import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.cluster.metadata.MetaDataIndexStateService; +import org.elasticsearch.cluster.metadata.IndexMetadata; +import org.elasticsearch.cluster.metadata.MetadataIndexStateService; import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider; import org.elasticsearch.common.Booleans; import org.elasticsearch.common.Strings; @@ -76,8 +76,8 @@ public class RecoveryIT extends AbstractRollingTestCase { final String index = "index_history_uuid"; if (CLUSTER_TYPE == ClusterType.OLD) { Settings.Builder settings = Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1) // if the node with the replica is the first to be restarted, while a replica is still recovering // then delayed allocation will kick in. When the node comes back, the master will search for a copy // but the recovering copy will be seen as invalid and the cluster health won't return to GREEN @@ -145,8 +145,8 @@ public class RecoveryIT extends AbstractRollingTestCase { switch (CLUSTER_TYPE) { case OLD: Settings.Builder settings = Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2) + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2) // if the node with the replica is the first to be restarted, while a replica is still recovering // then delayed allocation will kick in. When the node comes back, the master will search for a copy // but the recovering copy will be seen as invalid and the cluster health won't return to GREEN @@ -243,8 +243,8 @@ public class RecoveryIT extends AbstractRollingTestCase { switch (CLUSTER_TYPE) { case OLD: Settings.Builder settings = Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2) + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2) // if the node with the replica is the first to be restarted, while a replica is still recovering // then delayed allocation will kick in. When the node comes back, the master will search for a copy // but the recovering copy will be seen as invalid and the cluster health won't return to GREEN @@ -263,7 +263,7 @@ public class RecoveryIT extends AbstractRollingTestCase { final String oldNode = getNodeId(v -> v.before(Version.CURRENT)); // remove the replica and guaranteed the primary is placed on the old node updateIndexSettings(index, Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 0) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 0) .put(INDEX_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), (String)null) .put("index.routing.allocation.include._id", oldNode) ); @@ -286,7 +286,7 @@ public class RecoveryIT extends AbstractRollingTestCase { break; case UPGRADED: updateIndexSettings(index, Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2) .put("index.routing.allocation.include._id", (String)null) ); asyncIndexDocs(index, 60, 45).get(); @@ -310,8 +310,8 @@ public class RecoveryIT extends AbstractRollingTestCase { final String index = "recover_with_soft_deletes"; if (CLUSTER_TYPE == ClusterType.OLD) { Settings.Builder settings = Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1) // if the node with the replica is the first to be restarted, while a replica is still recovering // then delayed allocation will kick in. When the node comes back, the master will search for a copy // but the recovering copy will be seen as invalid and the cluster health won't return to GREEN @@ -346,8 +346,8 @@ public class RecoveryIT extends AbstractRollingTestCase { final String index = "recover_and_create_leases_in_promotion"; if (CLUSTER_TYPE == ClusterType.OLD) { Settings.Builder settings = Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), between(1, 5)) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), between(1, 2)) // triggers nontrivial promotion + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), between(1, 5)) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), between(1, 2)) // triggers nontrivial promotion .put(INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "100ms") .put(SETTING_ALLOCATION_MAX_RETRY.getKey(), "0") // fail faster .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), randomBoolean()); @@ -367,8 +367,8 @@ public class RecoveryIT extends AbstractRollingTestCase { switch (CLUSTER_TYPE) { case OLD: Settings.Builder settings = Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), between(1, 5)) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), between(0, 1)) + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), between(1, 5)) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), between(0, 1)) .put(INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "100ms") .put(SETTING_ALLOCATION_MAX_RETRY.getKey(), "0") // fail faster .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), randomBoolean()); @@ -421,8 +421,8 @@ public class RecoveryIT extends AbstractRollingTestCase { final String indexName = "closed_index_created_on_old"; if (CLUSTER_TYPE == ClusterType.OLD) { createIndex(indexName, Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1) // if the node with the replica is the first to be restarted, while a replica is still recovering // then delayed allocation will kick in. When the node comes back, the master will search for a copy // but the recovering copy will be seen as invalid and the cluster health won't return to GREEN @@ -461,8 +461,8 @@ public class RecoveryIT extends AbstractRollingTestCase { final Response indexExistsResponse = client().performRequest(indexExistsRequest); if (RestStatus.OK.getStatus() != indexExistsResponse.getStatusLine().getStatusCode()) { createIndex(indexName, Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 0) + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 0) .build()); ensureGreen(indexName); closeIndex(indexName); @@ -485,8 +485,8 @@ public class RecoveryIT extends AbstractRollingTestCase { final String indexName = "closed_index_replica_allocation"; if (CLUSTER_TYPE == ClusterType.OLD) { createIndex(indexName, Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1) .put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), "none") .put(INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "120s") .put("index.routing.allocation.include._name", CLUSTER_NAME + "-0") @@ -550,7 +550,7 @@ public class RecoveryIT extends AbstractRollingTestCase { final Map blocks = (Map) XContentMapValues.extractValue("blocks.indices." + index, state); assertThat(blocks, notNullValue()); - assertThat(blocks.containsKey(String.valueOf(MetaDataIndexStateService.INDEX_CLOSED_BLOCK_ID)), is(true)); + assertThat(blocks.containsKey(String.valueOf(MetadataIndexStateService.INDEX_CLOSED_BLOCK_ID)), is(true)); final Map settings = (Map) XContentMapValues.extractValue("settings", metadata); assertThat(settings, notNullValue()); @@ -634,8 +634,8 @@ public class RecoveryIT extends AbstractRollingTestCase { final String index = "test_update_doc"; if (CLUSTER_TYPE == ClusterType.OLD) { Settings.Builder settings = Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2); + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2); createIndex(index, settings.build()); indexDocs(index, 0, 100); } @@ -708,8 +708,8 @@ public class RecoveryIT extends AbstractRollingTestCase { final String index = "test_operation_based_recovery"; if (CLUSTER_TYPE == ClusterType.OLD) { createIndex(index, Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2) + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 2) .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), randomBoolean()).build()); ensureGreen(index); indexDocs(index, 0, randomIntBetween(100, 200)); @@ -735,8 +735,8 @@ public class RecoveryIT extends AbstractRollingTestCase { final String index = "turn_off_translog_retention"; if (CLUSTER_TYPE == ClusterType.OLD) { createIndex(index, Settings.builder() - .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) - .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), randomIntBetween(0, 2)) + .put(IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 1) + .put(IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), randomIntBetween(0, 2)) .put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true).build()); ensureGreen(index); indexDocs(index, 0, randomIntBetween(100, 200)); @@ -761,17 +761,17 @@ public class RecoveryIT extends AbstractRollingTestCase { if (CLUSTER_TYPE == ClusterType.OLD) { createIndex(indexName, Settings.builder() - .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) - .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, randomInt(2)) - .put(IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS, "0-all") + .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, randomInt(2)) + .put(IndexMetadata.SETTING_AUTO_EXPAND_REPLICAS, "0-all") .build()); ensureGreen(indexName); updateIndexSettings(indexName, - Settings.builder().put(IndexMetaData.INDEX_ROUTING_EXCLUDE_GROUP_PREFIX + "._id", nodes.get(randomInt(2)))); + Settings.builder().put(IndexMetadata.INDEX_ROUTING_EXCLUDE_GROUP_PREFIX + "._id", nodes.get(randomInt(2)))); } final int numberOfReplicas = Integer.parseInt( - getIndexSettingsAsMap(indexName).get(IndexMetaData.SETTING_NUMBER_OF_REPLICAS).toString()); + getIndexSettingsAsMap(indexName).get(IndexMetadata.SETTING_NUMBER_OF_REPLICAS).toString()); if (minimumNodeVersion.onOrAfter(Version.V_7_6_0)) { assertEquals(nodes.size() - 2, numberOfReplicas); ensureGreen(indexName); @@ -784,7 +784,7 @@ public class RecoveryIT extends AbstractRollingTestCase { final String indexName = "test_soft_deletes_disabled_warning"; if (CLUSTER_TYPE == ClusterType.OLD) { boolean softDeletesEnabled = true; - Settings.Builder settings = Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1); + Settings.Builder settings = Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1); if (randomBoolean()) { softDeletesEnabled = randomBoolean(); settings.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), softDeletesEnabled); diff --git a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/ContextAndHeaderTransportIT.java b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/ContextAndHeaderTransportIT.java index bab1bed8a30..5b3b13022ef 100644 --- a/qa/smoke-test-http/src/test/java/org/elasticsearch/http/ContextAndHeaderTransportIT.java +++ b/qa/smoke-test-http/src/test/java/org/elasticsearch/http/ContextAndHeaderTransportIT.java @@ -69,7 +69,7 @@ import java.util.Map; import java.util.concurrent.CopyOnWriteArrayList; import static java.util.Collections.singletonList; -import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; +import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; diff --git a/qa/smoke-test-ingest-with-all-dependencies/src/test/java/org/elasticsearch/ingest/IngestDocumentMustacheIT.java b/qa/smoke-test-ingest-with-all-dependencies/src/test/java/org/elasticsearch/ingest/IngestDocumentMustacheIT.java index ec993262a4d..cbf31e4bb4b 100644 --- a/qa/smoke-test-ingest-with-all-dependencies/src/test/java/org/elasticsearch/ingest/IngestDocumentMustacheIT.java +++ b/qa/smoke-test-ingest-with-all-dependencies/src/test/java/org/elasticsearch/ingest/IngestDocumentMustacheIT.java @@ -30,7 +30,7 @@ import static org.hamcrest.Matchers.equalTo; public class IngestDocumentMustacheIT extends AbstractScriptTestCase { - public void testAccessMetaDataViaTemplate() { + public void testAccessMetadataViaTemplate() { Map document = new HashMap<>(); document.put("foo", "bar"); IngestDocument ingestDocument = new IngestDocument("index", "type", "id", null, null, null, document); @@ -41,7 +41,7 @@ public class IngestDocumentMustacheIT extends AbstractScriptTestCase { assertThat(ingestDocument.getFieldValue("field1", String.class), equalTo("2 bar")); } - public void testAccessMapMetaDataViaTemplate() { + public void testAccessMapMetadataViaTemplate() { Map document = new HashMap<>(); Map innerObject = new HashMap<>(); innerObject.put("bar", "hello bar"); @@ -58,7 +58,7 @@ public class IngestDocumentMustacheIT extends AbstractScriptTestCase { assertThat(ingestDocument.getFieldValue("field1", String.class), equalTo("2 hello bar hello baz hello qux and fubar")); } - public void testAccessListMetaDataViaTemplate() { + public void testAccessListMetadataViaTemplate() { Map document = new HashMap<>(); document.put("list1", Arrays.asList("foo", "bar", null)); List> list = new ArrayList<>(); diff --git a/server/src/main/java/org/elasticsearch/ElasticsearchException.java b/server/src/main/java/org/elasticsearch/ElasticsearchException.java index 09253fe50d4..8e95a66867f 100644 --- a/server/src/main/java/org/elasticsearch/ElasticsearchException.java +++ b/server/src/main/java/org/elasticsearch/ElasticsearchException.java @@ -53,7 +53,7 @@ import java.util.stream.Collectors; import static java.util.Collections.emptyMap; import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableMap; -import static org.elasticsearch.cluster.metadata.IndexMetaData.INDEX_UUID_NA_VALUE; +import static org.elasticsearch.cluster.metadata.IndexMetadata.INDEX_UUID_NA_VALUE; import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureFieldName; diff --git a/server/src/main/java/org/elasticsearch/Version.java b/server/src/main/java/org/elasticsearch/Version.java index b35a9687d8a..36acb1f066e 100644 --- a/server/src/main/java/org/elasticsearch/Version.java +++ b/server/src/main/java/org/elasticsearch/Version.java @@ -19,7 +19,7 @@ package org.elasticsearch; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Strings; import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.collect.ImmutableOpenIntMap; @@ -223,16 +223,16 @@ public class Version implements Comparable, ToXContentFragment { * Return the {@link Version} of Elasticsearch that has been used to create an index given its settings. * * @throws IllegalStateException if the given index settings doesn't contain a value for the key - * {@value IndexMetaData#SETTING_VERSION_CREATED} + * {@value IndexMetadata#SETTING_VERSION_CREATED} */ public static Version indexCreated(Settings indexSettings) { - final Version indexVersion = IndexMetaData.SETTING_INDEX_VERSION_CREATED.get(indexSettings); + final Version indexVersion = IndexMetadata.SETTING_INDEX_VERSION_CREATED.get(indexSettings); if (indexVersion == V_EMPTY) { final String message = String.format( Locale.ROOT, "[%s] is not present in the index settings for index with UUID [%s]", - IndexMetaData.SETTING_INDEX_VERSION_CREATED.getKey(), - indexSettings.get(IndexMetaData.SETTING_INDEX_UUID)); + IndexMetadata.SETTING_INDEX_VERSION_CREATED.getKey(), + indexSettings.get(IndexMetadata.SETTING_INDEX_UUID)); throw new IllegalStateException(message); } return indexVersion; diff --git a/server/src/main/java/org/elasticsearch/action/DocWriteResponse.java b/server/src/main/java/org/elasticsearch/action/DocWriteResponse.java index 544cbb02f79..ccd03ca6564 100644 --- a/server/src/main/java/org/elasticsearch/action/DocWriteResponse.java +++ b/server/src/main/java/org/elasticsearch/action/DocWriteResponse.java @@ -23,7 +23,7 @@ import org.elasticsearch.action.support.WriteRequest; import org.elasticsearch.action.support.WriteRequest.RefreshPolicy; import org.elasticsearch.action.support.WriteResponse; import org.elasticsearch.action.support.replication.ReplicationResponse; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -330,7 +330,7 @@ public abstract class DocWriteResponse extends ReplicationResponse implements Wr if (token.isValue()) { if (_INDEX.equals(currentFieldName)) { // index uuid and shard id are unknown and can't be parsed back for now. - context.setShardId(new ShardId(new Index(parser.text(), IndexMetaData.INDEX_UUID_NA_VALUE), -1)); + context.setShardId(new ShardId(new Index(parser.text(), IndexMetadata.INDEX_UUID_NA_VALUE), -1)); } else if (_TYPE.equals(currentFieldName)) { context.setType(parser.text()); } else if (_ID.equals(currentFieldName)) { diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/AddVotingConfigExclusionsRequest.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/AddVotingConfigExclusionsRequest.java index df11435aba1..c5ca2dffe6c 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/AddVotingConfigExclusionsRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/AddVotingConfigExclusionsRequest.java @@ -21,7 +21,7 @@ package org.elasticsearch.action.admin.cluster.configuration; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.support.master.MasterNodeRequest; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfigExclusion; +import org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfigExclusion; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.io.stream.StreamInput; diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/TransportAddVotingConfigExclusionsAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/TransportAddVotingConfigExclusionsAction.java index 38d369e25bf..0ce24219891 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/TransportAddVotingConfigExclusionsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/TransportAddVotingConfigExclusionsAction.java @@ -31,10 +31,10 @@ import org.elasticsearch.cluster.ClusterStateObserver.Listener; import org.elasticsearch.cluster.ClusterStateUpdateTask; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; -import org.elasticsearch.cluster.coordination.CoordinationMetaData; -import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfigExclusion; +import org.elasticsearch.cluster.coordination.CoordinationMetadata; +import org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfigExclusion; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.Priority; import org.elasticsearch.common.inject.Inject; @@ -105,10 +105,10 @@ public class TransportAddVotingConfigExclusionsAction extends TransportMasterNod final int finalMaxVotingConfigExclusions = TransportAddVotingConfigExclusionsAction.this.maxVotingConfigExclusions; resolvedExclusions = resolveVotingConfigExclusionsAndCheckMaximum(request, currentState, finalMaxVotingConfigExclusions); - final CoordinationMetaData.Builder builder = CoordinationMetaData.builder(currentState.coordinationMetaData()); + final CoordinationMetadata.Builder builder = CoordinationMetadata.builder(currentState.coordinationMetadata()); resolvedExclusions.forEach(builder::addVotingConfigExclusion); - final MetaData newMetaData = MetaData.builder(currentState.metaData()).coordinationMetaData(builder.build()).build(); - final ClusterState newState = ClusterState.builder(currentState).metaData(newMetaData).build(); + final Metadata newMetadata = Metadata.builder(currentState.metadata()).coordinationMetadata(builder.build()).build(); + final ClusterState newState = ClusterState.builder(currentState).metadata(newMetadata).build(); assert newState.getVotingConfigExclusions().size() <= finalMaxVotingConfigExclusions; return newState; } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/TransportClearVotingConfigExclusionsAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/TransportClearVotingConfigExclusionsAction.java index c0fcd34e7b5..fb891f860a4 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/TransportClearVotingConfigExclusionsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/TransportClearVotingConfigExclusionsAction.java @@ -31,10 +31,10 @@ import org.elasticsearch.cluster.ClusterStateObserver.Listener; import org.elasticsearch.cluster.ClusterStateUpdateTask; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; -import org.elasticsearch.cluster.coordination.CoordinationMetaData; -import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfigExclusion; +import org.elasticsearch.cluster.coordination.CoordinationMetadata; +import org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfigExclusion; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.Priority; import org.elasticsearch.common.inject.Inject; @@ -119,11 +119,11 @@ public class TransportClearVotingConfigExclusionsAction clusterService.submitStateUpdateTask("clear-voting-config-exclusions", new ClusterStateUpdateTask(Priority.URGENT) { @Override public ClusterState execute(ClusterState currentState) { - final CoordinationMetaData newCoordinationMetaData = - CoordinationMetaData.builder(currentState.coordinationMetaData()).clearVotingConfigExclusions().build(); - final MetaData newMetaData = MetaData.builder(currentState.metaData()). - coordinationMetaData(newCoordinationMetaData).build(); - return ClusterState.builder(currentState).metaData(newMetaData).build(); + final CoordinationMetadata newCoordinationMetadata = + CoordinationMetadata.builder(currentState.coordinationMetadata()).clearVotingConfigExclusions().build(); + final Metadata newMetadata = Metadata.builder(currentState.metadata()). + coordinationMetadata(newCoordinationMetadata).build(); + return ClusterState.builder(currentState).metadata(newMetadata).build(); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/GetRepositoriesResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/GetRepositoriesResponse.java index 71215cf6fe8..1fe647279bc 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/GetRepositoriesResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/GetRepositoriesResponse.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.admin.cluster.repositories.get; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.cluster.metadata.RepositoriesMetaData; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.RepositoriesMetadata; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContentObject; @@ -39,14 +39,14 @@ import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpect */ public class GetRepositoriesResponse extends ActionResponse implements ToXContentObject { - private RepositoriesMetaData repositories; + private RepositoriesMetadata repositories; - GetRepositoriesResponse(RepositoriesMetaData repositories) { + GetRepositoriesResponse(RepositoriesMetadata repositories) { this.repositories = repositories; } GetRepositoriesResponse(StreamInput in) throws IOException { - repositories = new RepositoriesMetaData(in); + repositories = new RepositoriesMetadata(in); } /** @@ -54,7 +54,7 @@ public class GetRepositoriesResponse extends ActionResponse implements ToXConten * * @return list or repositories */ - public List repositories() { + public List repositories() { return repositories.repositories(); } @@ -68,13 +68,13 @@ public class GetRepositoriesResponse extends ActionResponse implements ToXConten public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(); repositories.toXContent(builder, - new DelegatingMapParams(Collections.singletonMap(RepositoriesMetaData.HIDE_GENERATIONS_PARAM, "true"), params)); + new DelegatingMapParams(Collections.singletonMap(RepositoriesMetadata.HIDE_GENERATIONS_PARAM, "true"), params)); builder.endObject(); return builder; } public static GetRepositoriesResponse fromXContent(XContentParser parser) throws IOException { ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.nextToken(), parser::getTokenLocation); - return new GetRepositoriesResponse(RepositoriesMetaData.fromXContent(parser)); + return new GetRepositoriesResponse(RepositoriesMetadata.fromXContent(parser)); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/TransportGetRepositoriesAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/TransportGetRepositoriesAction.java index 04320af0de0..b32254c3758 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/TransportGetRepositoriesAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/TransportGetRepositoriesAction.java @@ -26,9 +26,9 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.cluster.metadata.RepositoriesMetaData; -import org.elasticsearch.cluster.metadata.RepositoryMetaData; +import org.elasticsearch.cluster.metadata.Metadata; +import org.elasticsearch.cluster.metadata.RepositoriesMetadata; +import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; @@ -76,13 +76,13 @@ public class TransportGetRepositoriesAction extends @Override protected void masterOperation(final GetRepositoriesRequest request, ClusterState state, final ActionListener listener) { - MetaData metaData = state.metaData(); - RepositoriesMetaData repositories = metaData.custom(RepositoriesMetaData.TYPE); + Metadata metadata = state.metadata(); + RepositoriesMetadata repositories = metadata.custom(RepositoriesMetadata.TYPE); if (request.repositories().length == 0 || (request.repositories().length == 1 && "_all".equals(request.repositories()[0]))) { if (repositories != null) { listener.onResponse(new GetRepositoriesResponse(repositories)); } else { - listener.onResponse(new GetRepositoriesResponse(new RepositoriesMetaData(Collections.emptyList()))); + listener.onResponse(new GetRepositoriesResponse(new RepositoriesMetadata(Collections.emptyList()))); } } else { if (repositories != null) { @@ -91,23 +91,23 @@ public class TransportGetRepositoriesAction extends if (Regex.isSimpleMatchPattern(repositoryOrPattern) == false) { repositoriesToGet.add(repositoryOrPattern); } else { - for (RepositoryMetaData repository : repositories.repositories()) { + for (RepositoryMetadata repository : repositories.repositories()) { if (Regex.simpleMatch(repositoryOrPattern, repository.name())) { repositoriesToGet.add(repository.name()); } } } } - List repositoryListBuilder = new ArrayList<>(); + List repositoryListBuilder = new ArrayList<>(); for (String repository : repositoriesToGet) { - RepositoryMetaData repositoryMetaData = repositories.repository(repository); - if (repositoryMetaData == null) { + RepositoryMetadata repositoryMetadata = repositories.repository(repository); + if (repositoryMetadata == null) { listener.onFailure(new RepositoryMissingException(repository)); return; } - repositoryListBuilder.add(repositoryMetaData); + repositoryListBuilder.add(repositoryMetadata); } - listener.onResponse(new GetRepositoriesResponse(new RepositoriesMetaData(repositoryListBuilder))); + listener.onResponse(new GetRepositoriesResponse(new RepositoriesMetadata(repositoryListBuilder))); } else { listener.onFailure(new RepositoryMissingException(request.repositories()[0])); } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/settings/SettingsUpdater.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/settings/SettingsUpdater.java index ec72dd94967..7bbedf38264 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/settings/SettingsUpdater.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/settings/SettingsUpdater.java @@ -24,7 +24,7 @@ import org.apache.logging.log4j.message.ParameterizedMessage; import org.apache.logging.log4j.util.Supplier; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlocks; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Settings; @@ -72,14 +72,14 @@ final class SettingsUpdater { * - merge in the archived unknown or invalid settings */ final Tuple partitionedTransientSettings = - partitionKnownAndValidSettings(currentState.metaData().transientSettings(), "transient", logger); + partitionKnownAndValidSettings(currentState.metadata().transientSettings(), "transient", logger); final Settings knownAndValidTransientSettings = partitionedTransientSettings.v1(); final Settings unknownOrInvalidTransientSettings = partitionedTransientSettings.v2(); final Settings.Builder transientSettings = Settings.builder().put(knownAndValidTransientSettings); changed |= clusterSettings.updateDynamicSettings(transientToApply, transientSettings, transientUpdates, "transient"); final Tuple partitionedPersistentSettings = - partitionKnownAndValidSettings(currentState.metaData().persistentSettings(), "persistent", logger); + partitionKnownAndValidSettings(currentState.metadata().persistentSettings(), "persistent", logger); final Settings knownAndValidPersistentSettings = partitionedPersistentSettings.v1(); final Settings unknownOrInvalidPersistentSettings = partitionedPersistentSettings.v2(); final Settings.Builder persistentSettings = Settings.builder().put(knownAndValidPersistentSettings); @@ -94,26 +94,26 @@ final class SettingsUpdater { clusterSettings.validate(transientFinalSettings, true); clusterSettings.validate(persistentFinalSettings, true); - MetaData.Builder metaData = MetaData.builder(currentState.metaData()) + Metadata.Builder metadata = Metadata.builder(currentState.metadata()) .transientSettings(Settings.builder().put(transientFinalSettings).put(unknownOrInvalidTransientSettings).build()) .persistentSettings(Settings.builder().put(persistentFinalSettings).put(unknownOrInvalidPersistentSettings).build()); ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks()); - boolean updatedReadOnly = MetaData.SETTING_READ_ONLY_SETTING.get(metaData.persistentSettings()) - || MetaData.SETTING_READ_ONLY_SETTING.get(metaData.transientSettings()); + boolean updatedReadOnly = Metadata.SETTING_READ_ONLY_SETTING.get(metadata.persistentSettings()) + || Metadata.SETTING_READ_ONLY_SETTING.get(metadata.transientSettings()); if (updatedReadOnly) { - blocks.addGlobalBlock(MetaData.CLUSTER_READ_ONLY_BLOCK); + blocks.addGlobalBlock(Metadata.CLUSTER_READ_ONLY_BLOCK); } else { - blocks.removeGlobalBlock(MetaData.CLUSTER_READ_ONLY_BLOCK); + blocks.removeGlobalBlock(Metadata.CLUSTER_READ_ONLY_BLOCK); } - boolean updatedReadOnlyAllowDelete = MetaData.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.get(metaData.persistentSettings()) - || MetaData.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.get(metaData.transientSettings()); + boolean updatedReadOnlyAllowDelete = Metadata.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.get(metadata.persistentSettings()) + || Metadata.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.get(metadata.transientSettings()); if (updatedReadOnlyAllowDelete) { - blocks.addGlobalBlock(MetaData.CLUSTER_READ_ONLY_ALLOW_DELETE_BLOCK); + blocks.addGlobalBlock(Metadata.CLUSTER_READ_ONLY_ALLOW_DELETE_BLOCK); } else { - blocks.removeGlobalBlock(MetaData.CLUSTER_READ_ONLY_ALLOW_DELETE_BLOCK); + blocks.removeGlobalBlock(Metadata.CLUSTER_READ_ONLY_ALLOW_DELETE_BLOCK); } - clusterState = builder(currentState).metaData(metaData).blocks(blocks).build(); + clusterState = builder(currentState).metadata(metadata).blocks(blocks).build(); } else { clusterState = currentState; } @@ -122,7 +122,7 @@ final class SettingsUpdater { * Now we try to apply things and if they are invalid we fail. This dry run will validate, parse settings, and trigger deprecation * logging, but will not actually apply them. */ - final Settings settings = clusterState.metaData().settings(); + final Settings settings = clusterState.metadata().settings(); clusterSettings.validateUpdate(settings); return clusterState; diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/settings/TransportClusterUpdateSettingsAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/settings/TransportClusterUpdateSettingsAction.java index ed39fc42e6d..68aff6343dc 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/settings/TransportClusterUpdateSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/settings/TransportClusterUpdateSettingsAction.java @@ -31,7 +31,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.allocation.AllocationService; import org.elasticsearch.cluster.service.ClusterService; @@ -74,10 +74,10 @@ public class TransportClusterUpdateSettingsAction extends // allow for dedicated changes to the metadata blocks, so we don't block those to allow to "re-enable" it if (request.transientSettings().size() + request.persistentSettings().size() == 1) { // only one setting - if (MetaData.SETTING_READ_ONLY_SETTING.exists(request.persistentSettings()) - || MetaData.SETTING_READ_ONLY_SETTING.exists(request.transientSettings()) - || MetaData.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.exists(request.transientSettings()) - || MetaData.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.exists(request.persistentSettings())) { + if (Metadata.SETTING_READ_ONLY_SETTING.exists(request.persistentSettings()) + || Metadata.SETTING_READ_ONLY_SETTING.exists(request.transientSettings()) + || Metadata.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.exists(request.transientSettings()) + || Metadata.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.exists(request.persistentSettings())) { // one of the settings above as the only setting in the request means - resetting the block! return null; } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotIndexShardStatus.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotIndexShardStatus.java index e9eb63ad5db..05b139fc9e3 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotIndexShardStatus.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotIndexShardStatus.java @@ -21,7 +21,7 @@ package org.elasticsearch.action.admin.cluster.snapshots.status; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.action.support.broadcast.BroadcastShardResponse; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -198,7 +198,7 @@ public class SnapshotIndexShardStatus extends BroadcastShardResponse implements throw new ElasticsearchParseException( "failed to parse snapshot index shard status [{}], expected numeric shard id but got [{}]", indexId, shardName); } - ShardId shardId = new ShardId(new Index(indexId, IndexMetaData.INDEX_UUID_NA_VALUE), shard); + ShardId shardId = new ShardId(new Index(indexId, IndexMetadata.INDEX_UUID_NA_VALUE), shard); return innerParser.parse(p, shardId); }; } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequest.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequest.java index b89107d5560..ddc2f333159 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequest.java @@ -37,10 +37,10 @@ public class ClusterStateRequest extends MasterNodeReadRequest= 1, but instead is [" + - waitForMetaDataVersion + "]"); + public ClusterStateRequest waitForMetadataVersion(long waitForMetadataVersion) { + if (waitForMetadataVersion < 1) { + throw new IllegalArgumentException("provided waitForMetadataVersion should be >= 1, but instead is [" + + waitForMetadataVersion + "]"); } - this.waitForMetaDataVersion = waitForMetaDataVersion; + this.waitForMetadataVersion = waitForMetadataVersion; return this; } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequestBuilder.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequestBuilder.java index da5074b41aa..2c5f73c9b51 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequestBuilder.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequestBuilder.java @@ -53,11 +53,11 @@ public class ClusterStateRequestBuilder extends MasterNodeReadOperationRequestBu } /** - * Should the cluster state result include the {@link org.elasticsearch.cluster.metadata.MetaData}. Defaults + * Should the cluster state result include the {@link org.elasticsearch.cluster.metadata.Metadata}. Defaults * to {@code true}. */ - public ClusterStateRequestBuilder setMetaData(boolean filter) { - request.metaData(filter); + public ClusterStateRequestBuilder setMetadata(boolean filter) { + request.metadata(filter); return this; } @@ -89,7 +89,7 @@ public class ClusterStateRequestBuilder extends MasterNodeReadOperationRequestBu } /** - * When {@link #setMetaData(boolean)} is set, which indices to return the {@link org.elasticsearch.cluster.metadata.IndexMetaData} + * When {@link #setMetadata(boolean)} is set, which indices to return the {@link org.elasticsearch.cluster.metadata.IndexMetadata} * for. Defaults to all indices. */ public ClusterStateRequestBuilder setIndices(String... indices) { @@ -104,15 +104,15 @@ public class ClusterStateRequestBuilder extends MasterNodeReadOperationRequestBu /** * Causes the request to wait for the metadata version to advance to at least the given version. - * @param waitForMetaDataVersion The metadata version for which to wait + * @param waitForMetadataVersion The metadata version for which to wait */ - public ClusterStateRequestBuilder setWaitForMetaDataVersion(long waitForMetaDataVersion) { - request.waitForMetaDataVersion(waitForMetaDataVersion); + public ClusterStateRequestBuilder setWaitForMetadataVersion(long waitForMetadataVersion) { + request.waitForMetadataVersion(waitForMetadataVersion); return this; } /** - * If {@link ClusterStateRequest#waitForMetaDataVersion()} is set then this determines how long to wait + * If {@link ClusterStateRequest#waitForMetadataVersion()} is set then this determines how long to wait */ public ClusterStateRequestBuilder setWaitForTimeOut(TimeValue waitForTimeout) { request.waitForTimeout(waitForTimeout); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java index b5931d4b4e1..11f5a39da82 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java @@ -29,10 +29,10 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateObserver; import org.elasticsearch.cluster.NotMasterException; import org.elasticsearch.cluster.block.ClusterBlockException; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.cluster.metadata.MetaData.Custom; +import org.elasticsearch.cluster.metadata.Metadata; +import org.elasticsearch.cluster.metadata.Metadata.Custom; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; @@ -89,8 +89,8 @@ public class TransportClusterStateAction extends TransportMasterNodeReadAction listener) throws IOException { final Predicate acceptableClusterStatePredicate - = request.waitForMetaDataVersion() == null ? clusterState -> true - : clusterState -> clusterState.metaData().version() >= request.waitForMetaDataVersion(); + = request.waitForMetadataVersion() == null ? clusterState -> true + : clusterState -> clusterState.metadata().version() >= request.waitForMetadataVersion(); final Predicate acceptableClusterStateOrNotMasterPredicate = request.local() ? acceptableClusterStatePredicate @@ -109,7 +109,7 @@ public class TransportClusterStateAction extends TransportMasterNodeReadAction buildResponse(request, newState)); } else { listener.onFailure(new NotMasterException( - "master stepped down waiting for metadata version " + request.waitForMetaDataVersion())); + "master stepped down waiting for metadata version " + request.waitForMetadataVersion())); } } @@ -159,32 +159,32 @@ public class TransportClusterStateAction extends TransportMasterNodeReadAction 0) { - mdBuilder.version(currentState.metaData().version()); + mdBuilder.version(currentState.metadata().version()); String[] indices = indexNameExpressionResolver.concreteIndexNames(currentState, request); for (String filteredIndex : indices) { - IndexMetaData indexMetaData = currentState.metaData().index(filteredIndex); - if (indexMetaData != null) { - mdBuilder.put(indexMetaData, false); + IndexMetadata indexMetadata = currentState.metadata().index(filteredIndex); + if (indexMetadata != null) { + mdBuilder.put(indexMetadata, false); } } } else { - mdBuilder = MetaData.builder(currentState.metaData()); + mdBuilder = Metadata.builder(currentState.metadata()); } // filter out metadata that shouldn't be returned by the API - for (ObjectObjectCursor custom : currentState.metaData().customs()) { - if (custom.value.context().contains(MetaData.XContentContext.API) == false) { + for (ObjectObjectCursor custom : currentState.metadata().customs()) { + if (custom.value.context().contains(Metadata.XContentContext.API) == false) { mdBuilder.removeCustom(custom.key); } } } - builder.metaData(mdBuilder); + builder.metadata(mdBuilder); if (request.customs()) { for (ObjectObjectCursor custom : currentState.customs()) { diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/AnalysisStats.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/AnalysisStats.java index 884ce6a3617..b447369815b 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/AnalysisStats.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/AnalysisStats.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.admin.cluster.stats; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.cluster.metadata.MappingMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; +import org.elasticsearch.cluster.metadata.MappingMetadata; import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -62,11 +62,11 @@ public final class AnalysisStats implements ToXContentFragment, Writeable { final Map usedBuiltInTokenFilters = new HashMap<>(); final Map usedBuiltInAnalyzers = new HashMap<>(); - for (IndexMetaData indexMetaData : state.metaData()) { + for (IndexMetadata indexMetadata : state.metadata()) { Set indexAnalyzers = new HashSet<>(); - MappingMetaData mappingMetaData = indexMetaData.mapping(); - if (mappingMetaData != null) { - MappingVisitor.visitMapping(mappingMetaData.getSourceAsMap(), fieldMapping -> { + MappingMetadata mappingMetadata = indexMetadata.mapping(); + if (mappingMetadata != null) { + MappingVisitor.visitMapping(mappingMetadata.getSourceAsMap(), fieldMapping -> { for (String key : new String[] { "analyzer", "search_analyzer", "search_quote_analyzer" }) { Object analyzerO = fieldMapping.get(key); if (analyzerO != null) { @@ -90,7 +90,7 @@ public final class AnalysisStats implements ToXContentFragment, Writeable { Set indexTokenizerTypes = new HashSet<>(); Set indexTokenFilterTypes = new HashSet<>(); - Settings indexSettings = indexMetaData.getSettings(); + Settings indexSettings = indexMetadata.getSettings(); Map analyzerSettings = indexSettings.getGroups("index.analysis.analyzer"); usedBuiltInAnalyzers.keySet().removeAll(analyzerSettings.keySet()); for (Settings analyzerSetting : analyzerSettings.values()) { diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/MappingStats.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/MappingStats.java index 8892ca9dcf1..6241ae649c8 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/MappingStats.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/MappingStats.java @@ -20,8 +20,8 @@ package org.elasticsearch.action.admin.cluster.stats; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.cluster.metadata.MappingMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; +import org.elasticsearch.cluster.metadata.MappingMetadata; import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -51,11 +51,11 @@ public final class MappingStats implements ToXContentFragment, Writeable { */ public static MappingStats of(ClusterState state) { Map fieldTypes = new HashMap<>(); - for (IndexMetaData indexMetaData : state.metaData()) { + for (IndexMetadata indexMetadata : state.metadata()) { Set indexFieldTypes = new HashSet<>(); - MappingMetaData mappingMetaData = indexMetaData.mapping(); - if (mappingMetaData != null) { - MappingVisitor.visitMapping(mappingMetaData.getSourceAsMap(), fieldMapping -> { + MappingMetadata mappingMetadata = indexMetadata.mapping(); + if (mappingMetadata != null) { + MappingVisitor.visitMapping(mappingMetadata.getSourceAsMap(), fieldMapping -> { String type = null; Object typeO = fieldMapping.get("type"); if (typeO != null) { diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/TransportClusterStatsAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/TransportClusterStatsAction.java index cd48203dbdf..b3c3fd2e5bd 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/TransportClusterStatsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/TransportClusterStatsAction.java @@ -76,7 +76,7 @@ public class TransportClusterStatsAction extends TransportNodesAction requestValidators; @Inject @@ -72,7 +72,7 @@ public class TransportIndicesAliasesAction extends TransportMasterNodeAction requestValidators) { @@ -123,13 +123,13 @@ public class TransportIndicesAliasesAction extends TransportMasterNodeAction> aliasMetaData = metaData.findAliases(action, indexAsArray); + ImmutableOpenMap> aliasMetadata = metadata.findAliases(action, indexAsArray); List finalAliases = new ArrayList<>(); - for (ObjectCursor> curAliases : aliasMetaData.values()) { - for (AliasMetaData aliasMeta: curAliases.value) { + for (ObjectCursor> curAliases : aliasMetadata.values()) { + for (AliasMetadata aliasMeta: curAliases.value) { finalAliases.add(aliasMeta.alias()); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/TransportAliasesExistAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/TransportAliasesExistAction.java index c1afa4ccf86..17a4ab3d6dc 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/TransportAliasesExistAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/TransportAliasesExistAction.java @@ -64,7 +64,7 @@ public class TransportAliasesExistAction extends TransportMasterNodeReadAction listener) { String[] concreteIndices = indexNameExpressionResolver.concreteIndexNames(state, request); - boolean result = state.metaData().hasAliases(request.aliases(), concreteIndices); + boolean result = state.metadata().hasAliases(request.aliases(), concreteIndices); listener.onResponse(new AliasesExistResponse(result)); } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesResponse.java index 3376d9c8100..1d06ace0691 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesResponse.java @@ -21,7 +21,7 @@ package org.elasticsearch.action.admin.indices.alias.get; import com.carrotsearch.hppc.cursors.ObjectObjectCursor; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.cluster.metadata.AliasMetaData; +import org.elasticsearch.cluster.metadata.AliasMetadata; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -34,40 +34,40 @@ import java.util.Objects; public class GetAliasesResponse extends ActionResponse { - private ImmutableOpenMap> aliases = ImmutableOpenMap.of(); + private ImmutableOpenMap> aliases = ImmutableOpenMap.of(); - public GetAliasesResponse(ImmutableOpenMap> aliases) { + public GetAliasesResponse(ImmutableOpenMap> aliases) { this.aliases = aliases; } public GetAliasesResponse(StreamInput in) throws IOException { super(in); int size = in.readVInt(); - ImmutableOpenMap.Builder> aliasesBuilder = ImmutableOpenMap.builder(); + ImmutableOpenMap.Builder> aliasesBuilder = ImmutableOpenMap.builder(); for (int i = 0; i < size; i++) { String key = in.readString(); int valueSize = in.readVInt(); - List value = new ArrayList<>(valueSize); + List value = new ArrayList<>(valueSize); for (int j = 0; j < valueSize; j++) { - value.add(new AliasMetaData(in)); + value.add(new AliasMetadata(in)); } aliasesBuilder.put(key, Collections.unmodifiableList(value)); } aliases = aliasesBuilder.build(); } - public ImmutableOpenMap> getAliases() { + public ImmutableOpenMap> getAliases() { return aliases; } @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(aliases.size()); - for (ObjectObjectCursor> entry : aliases) { + for (ObjectObjectCursor> entry : aliases) { out.writeString(entry.key); out.writeVInt(entry.value.size()); - for (AliasMetaData aliasMetaData : entry.value) { - aliasMetaData.writeTo(out); + for (AliasMetadata aliasMetadata : entry.value) { + aliasMetadata.writeTo(out); } } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java index e45e7c2930a..d81067a8695 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java @@ -24,7 +24,7 @@ import org.elasticsearch.action.support.master.TransportMasterNodeReadAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; -import org.elasticsearch.cluster.metadata.AliasMetaData; +import org.elasticsearch.cluster.metadata.AliasMetadata; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.collect.ImmutableOpenMap; @@ -67,20 +67,20 @@ public class TransportGetAliasesAction extends TransportMasterNodeReadAction listener) { String[] concreteIndices = indexNameExpressionResolver.concreteIndexNames(state, request); - ImmutableOpenMap> aliases = state.metaData().findAliases(request, concreteIndices); + ImmutableOpenMap> aliases = state.metadata().findAliases(request, concreteIndices); listener.onResponse(new GetAliasesResponse(postProcess(request, concreteIndices, aliases))); } /** * Fills alias result with empty entries for requested indices when no specific aliases were requested. */ - static ImmutableOpenMap> postProcess(GetAliasesRequest request, String[] concreteIndices, - ImmutableOpenMap> aliases) { + static ImmutableOpenMap> postProcess(GetAliasesRequest request, String[] concreteIndices, + ImmutableOpenMap> aliases) { boolean noAliasesSpecified = request.getOriginalAliases() == null || request.getOriginalAliases().length == 0; - ImmutableOpenMap.Builder> mapBuilder = ImmutableOpenMap.builder(aliases); + ImmutableOpenMap.Builder> mapBuilder = ImmutableOpenMap.builder(aliases); for (String index : concreteIndices) { if (aliases.get(index) == null && noAliasesSpecified) { - List previous = mapBuilder.put(index, Collections.emptyList()); + List previous = mapBuilder.put(index, Collections.emptyList()); assert previous == null; } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java index 14d45488764..d8e5d1953b9 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java @@ -30,7 +30,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaDataIndexStateService; +import org.elasticsearch.cluster.metadata.MetadataIndexStateService; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; @@ -53,7 +53,7 @@ public class TransportCloseIndexAction extends TransportMasterNodeAction CLUSTER_INDICES_CLOSE_ENABLE_SETTING = @@ -61,7 +61,7 @@ public class TransportCloseIndexAction extends TransportMasterNodeAction { - private final MetaDataCreateIndexService createIndexService; + private final MetadataCreateIndexService createIndexService; @Inject public TransportCreateIndexAction(TransportService transportService, ClusterService clusterService, - ThreadPool threadPool, MetaDataCreateIndexService createIndexService, + ThreadPool threadPool, MetadataCreateIndexService createIndexService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) { super(CreateIndexAction.NAME, transportService, clusterService, threadPool, actionFilters, CreateIndexRequest::new, indexNameExpressionResolver); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/datastream/CreateDataStreamAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/datastream/CreateDataStreamAction.java index 0db3f0eb168..53698fe38af 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/datastream/CreateDataStreamAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/datastream/CreateDataStreamAction.java @@ -34,8 +34,8 @@ import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.DataStream; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.cluster.metadata.MetaDataCreateIndexService; +import org.elasticsearch.cluster.metadata.Metadata; +import org.elasticsearch.cluster.metadata.MetadataCreateIndexService; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.Priority; import org.elasticsearch.common.Strings; @@ -161,17 +161,17 @@ public class CreateDataStreamAction extends ActionType { } static ClusterState createDataStream(ClusterState currentState, Request request) { - if (currentState.metaData().dataStreams().containsKey(request.name)) { + if (currentState.metadata().dataStreams().containsKey(request.name)) { throw new IllegalArgumentException("data_stream [" + request.name + "] already exists"); } - MetaDataCreateIndexService.validateIndexOrAliasName(request.name, + MetadataCreateIndexService.validateIndexOrAliasName(request.name, (s1, s2) -> new IllegalArgumentException("data_stream [" + s1 + "] " + s2)); - MetaData.Builder builder = MetaData.builder(currentState.metaData()).put( + Metadata.Builder builder = Metadata.builder(currentState.metadata()).put( new DataStream(request.name, request.timestampFieldName, Collections.emptyList())); logger.info("adding data stream [{}]", request.name); - return ClusterState.builder(currentState).metaData(builder).build(); + return ClusterState.builder(currentState).metadata(builder).build(); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/datastream/DeleteDataStreamAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/datastream/DeleteDataStreamAction.java index cb5df4349be..fb29a8c2d84 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/datastream/DeleteDataStreamAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/datastream/DeleteDataStreamAction.java @@ -34,7 +34,7 @@ import org.elasticsearch.cluster.ClusterStateUpdateTask; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.Priority; import org.elasticsearch.common.Strings; @@ -151,7 +151,7 @@ public class DeleteDataStreamAction extends ActionType { static ClusterState removeDataStream(ClusterState currentState, Request request) { Set dataStreams = new HashSet<>(); - for (String dataStreamName : currentState.metaData().dataStreams().keySet()) { + for (String dataStreamName : currentState.metadata().dataStreams().keySet()) { if (Regex.simpleMatch(request.name, dataStreamName)) { dataStreams.add(dataStreamName); } @@ -164,12 +164,12 @@ public class DeleteDataStreamAction extends ActionType { } throw new ResourceNotFoundException("data_streams matching [" + request.name + "] not found"); } - MetaData.Builder metaData = MetaData.builder(currentState.metaData()); + Metadata.Builder metadata = Metadata.builder(currentState.metadata()); for (String dataStreamName : dataStreams) { logger.info("removing data stream [{}]", dataStreamName); - metaData.removeDataStream(dataStreamName); + metadata.removeDataStream(dataStreamName); } - return ClusterState.builder(currentState).metaData(metaData).build(); + return ClusterState.builder(currentState).metadata(metadata).build(); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/datastream/GetDataStreamsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/datastream/GetDataStreamsAction.java index 8faaad8061c..5c3d88d71cd 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/datastream/GetDataStreamsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/datastream/GetDataStreamsAction.java @@ -160,7 +160,7 @@ public class GetDataStreamsAction extends ActionType getDataStreams(ClusterState clusterState, Request request) { - Map dataStreams = clusterState.metaData().dataStreams(); + Map dataStreams = clusterState.metadata().dataStreams(); // return all data streams if no name was specified if (request.names.length == 0) { diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java index dc7ff05bf88..4b4128566a1 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java @@ -31,7 +31,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaDataDeleteIndexService; +import org.elasticsearch.cluster.metadata.MetadataDeleteIndexService; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; @@ -52,12 +52,12 @@ public class TransportDeleteIndexAction extends TransportMasterNodeAction> mappings = ImmutableOpenMap.of(); - private ImmutableOpenMap> aliases = ImmutableOpenMap.of(); + private ImmutableOpenMap> mappings = ImmutableOpenMap.of(); + private ImmutableOpenMap> aliases = ImmutableOpenMap.of(); private ImmutableOpenMap settings = ImmutableOpenMap.of(); private ImmutableOpenMap defaultSettings = ImmutableOpenMap.of(); private String[] indices; public GetIndexResponse(String[] indices, - ImmutableOpenMap> mappings, - ImmutableOpenMap> aliases, + ImmutableOpenMap> mappings, + ImmutableOpenMap> aliases, ImmutableOpenMap settings, ImmutableOpenMap defaultSettings) { this.indices = indices; @@ -87,26 +87,26 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject this.indices = in.readStringArray(); int mappingsSize = in.readVInt(); - ImmutableOpenMap.Builder> mappingsMapBuilder = ImmutableOpenMap.builder(); + ImmutableOpenMap.Builder> mappingsMapBuilder = ImmutableOpenMap.builder(); for (int i = 0; i < mappingsSize; i++) { String key = in.readString(); int valueSize = in.readVInt(); - ImmutableOpenMap.Builder mappingEntryBuilder = ImmutableOpenMap.builder(); + ImmutableOpenMap.Builder mappingEntryBuilder = ImmutableOpenMap.builder(); for (int j = 0; j < valueSize; j++) { - mappingEntryBuilder.put(in.readString(), new MappingMetaData(in)); + mappingEntryBuilder.put(in.readString(), new MappingMetadata(in)); } mappingsMapBuilder.put(key, mappingEntryBuilder.build()); } mappings = mappingsMapBuilder.build(); int aliasesSize = in.readVInt(); - ImmutableOpenMap.Builder> aliasesMapBuilder = ImmutableOpenMap.builder(); + ImmutableOpenMap.Builder> aliasesMapBuilder = ImmutableOpenMap.builder(); for (int i = 0; i < aliasesSize; i++) { String key = in.readString(); int valueSize = in.readVInt(); - List aliasEntryBuilder = new ArrayList<>(valueSize); + List aliasEntryBuilder = new ArrayList<>(valueSize); for (int j = 0; j < valueSize; j++) { - aliasEntryBuilder.add(new AliasMetaData(in)); + aliasEntryBuilder.add(new AliasMetadata(in)); } aliasesMapBuilder.put(key, Collections.unmodifiableList(aliasEntryBuilder)); } @@ -138,19 +138,19 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject return indices(); } - public ImmutableOpenMap> mappings() { + public ImmutableOpenMap> mappings() { return mappings; } - public ImmutableOpenMap> getMappings() { + public ImmutableOpenMap> getMappings() { return mappings(); } - public ImmutableOpenMap> aliases() { + public ImmutableOpenMap> aliases() { return aliases; } - public ImmutableOpenMap> getAliases() { + public ImmutableOpenMap> getAliases() { return aliases(); } @@ -202,19 +202,19 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject public void writeTo(StreamOutput out) throws IOException { out.writeStringArray(indices); out.writeVInt(mappings.size()); - for (ObjectObjectCursor> indexEntry : mappings) { + for (ObjectObjectCursor> indexEntry : mappings) { out.writeString(indexEntry.key); out.writeVInt(indexEntry.value.size()); - for (ObjectObjectCursor mappingEntry : indexEntry.value) { + for (ObjectObjectCursor mappingEntry : indexEntry.value) { out.writeString(mappingEntry.key); mappingEntry.value.writeTo(out); } } out.writeVInt(aliases.size()); - for (ObjectObjectCursor> indexEntry : aliases) { + for (ObjectObjectCursor> indexEntry : aliases) { out.writeString(indexEntry.key); out.writeVInt(indexEntry.value.size()); - for (AliasMetaData aliasEntry : indexEntry.value) { + for (AliasMetadata aliasEntry : indexEntry.value) { aliasEntry.writeTo(out); } } @@ -240,29 +240,29 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject builder.startObject(index); { builder.startObject("aliases"); - List indexAliases = aliases.get(index); + List indexAliases = aliases.get(index); if (indexAliases != null) { - for (final AliasMetaData alias : indexAliases) { - AliasMetaData.Builder.toXContent(alias, builder, params); + for (final AliasMetadata alias : indexAliases) { + AliasMetadata.Builder.toXContent(alias, builder, params); } } builder.endObject(); - ImmutableOpenMap indexMappings = mappings.get(index); + ImmutableOpenMap indexMappings = mappings.get(index); boolean includeTypeName = params.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, DEFAULT_INCLUDE_TYPE_NAME_POLICY); if (includeTypeName) { builder.startObject("mappings"); if (indexMappings != null) { - for (final ObjectObjectCursor typeEntry : indexMappings) { + for (final ObjectObjectCursor typeEntry : indexMappings) { builder.field(typeEntry.key); builder.map(typeEntry.value.sourceAsMap()); } } builder.endObject(); } else { - MappingMetaData mappings = null; - for (final ObjectObjectCursor typeEntry : indexMappings) { + MappingMetadata mappings = null; + for (final ObjectObjectCursor typeEntry : indexMappings) { if (typeEntry.key.equals(MapperService.DEFAULT_MAPPING) == false) { assert mappings == null; mappings = typeEntry.value; @@ -297,25 +297,25 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject return builder; } - private static List parseAliases(XContentParser parser) throws IOException { - List indexAliases = new ArrayList<>(); + private static List parseAliases(XContentParser parser) throws IOException { + List indexAliases = new ArrayList<>(); // We start at START_OBJECT since parseIndexEntry ensures that while (parser.nextToken() != Token.END_OBJECT) { ensureExpectedToken(Token.FIELD_NAME, parser.currentToken(), parser::getTokenLocation); - indexAliases.add(AliasMetaData.Builder.fromXContent(parser)); + indexAliases.add(AliasMetadata.Builder.fromXContent(parser)); } return indexAliases; } - private static ImmutableOpenMap parseMappings(XContentParser parser) throws IOException { - ImmutableOpenMap.Builder indexMappings = ImmutableOpenMap.builder(); + private static ImmutableOpenMap parseMappings(XContentParser parser) throws IOException { + ImmutableOpenMap.Builder indexMappings = ImmutableOpenMap.builder(); // We start at START_OBJECT since parseIndexEntry ensures that while (parser.nextToken() != Token.END_OBJECT) { ensureExpectedToken(Token.FIELD_NAME, parser.currentToken(), parser::getTokenLocation); parser.nextToken(); if (parser.currentToken() == Token.START_OBJECT) { String mappingType = parser.currentName(); - indexMappings.put(mappingType, new MappingMetaData(mappingType, parser.map())); + indexMappings.put(mappingType, new MappingMetadata(mappingType, parser.map())); } else if (parser.currentToken() == Token.START_ARRAY) { parser.skipChildren(); } @@ -324,8 +324,8 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject } private static IndexEntry parseIndexEntry(XContentParser parser) throws IOException { - List indexAliases = null; - ImmutableOpenMap indexMappings = null; + List indexAliases = null; + ImmutableOpenMap indexMappings = null; Settings indexSettings = null; Settings indexDefaultSettings = null; // We start at START_OBJECT since fromXContent ensures that @@ -358,11 +358,11 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject // This is just an internal container to make stuff easier for returning private static class IndexEntry { - List indexAliases = new ArrayList<>(); - ImmutableOpenMap indexMappings = ImmutableOpenMap.of(); + List indexAliases = new ArrayList<>(); + ImmutableOpenMap indexMappings = ImmutableOpenMap.of(); Settings indexSettings = Settings.EMPTY; Settings indexDefaultSettings = Settings.EMPTY; - IndexEntry(List indexAliases, ImmutableOpenMap indexMappings, + IndexEntry(List indexAliases, ImmutableOpenMap indexMappings, Settings indexSettings, Settings indexDefaultSettings) { if (indexAliases != null) this.indexAliases = indexAliases; if (indexMappings != null) this.indexMappings = indexMappings; @@ -372,8 +372,8 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject } public static GetIndexResponse fromXContent(XContentParser parser) throws IOException { - ImmutableOpenMap.Builder> aliases = ImmutableOpenMap.builder(); - ImmutableOpenMap.Builder> mappings = ImmutableOpenMap.builder(); + ImmutableOpenMap.Builder> aliases = ImmutableOpenMap.builder(); + ImmutableOpenMap.Builder> mappings = ImmutableOpenMap.builder(); ImmutableOpenMap.Builder settings = ImmutableOpenMap.builder(); ImmutableOpenMap.Builder defaultSettings = ImmutableOpenMap.builder(); List indices = new ArrayList<>(); @@ -391,7 +391,7 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject indices.add(indexName); IndexEntry indexEntry = parseIndexEntry(parser); // make the order deterministic - CollectionUtil.timSort(indexEntry.indexAliases, Comparator.comparing(AliasMetaData::alias)); + CollectionUtil.timSort(indexEntry.indexAliases, Comparator.comparing(AliasMetadata::alias)); aliases.put(indexName, Collections.unmodifiableList(indexEntry.indexAliases)); mappings.put(indexName, indexEntry.indexMappings); settings.put(indexName, indexEntry.indexSettings); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/get/TransportGetIndexAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/get/TransportGetIndexAction.java index 6fb6da59735..21708b8e497 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/get/TransportGetIndexAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/get/TransportGetIndexAction.java @@ -27,10 +27,10 @@ import org.elasticsearch.action.support.master.info.TransportClusterInfoAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; -import org.elasticsearch.cluster.metadata.AliasMetaData; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.AliasMetadata; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MappingMetaData; +import org.elasticsearch.cluster.metadata.MappingMetadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.inject.Inject; @@ -86,8 +86,8 @@ public class TransportGetIndexAction extends TransportClusterInfoAction listener) { - ImmutableOpenMap> mappingsResult = ImmutableOpenMap.of(); - ImmutableOpenMap> aliasesResult = ImmutableOpenMap.of(); + ImmutableOpenMap> mappingsResult = ImmutableOpenMap.of(); + ImmutableOpenMap> aliasesResult = ImmutableOpenMap.of(); ImmutableOpenMap settings = ImmutableOpenMap.of(); ImmutableOpenMap defaultSettings = ImmutableOpenMap.of(); Feature[] features = request.features(); @@ -99,7 +99,7 @@ public class TransportGetIndexAction extends TransportClusterInfoAction settingsMapBuilder = ImmutableOpenMap.builder(); ImmutableOpenMap.Builder defaultSettingsMapBuilder = ImmutableOpenMap.builder(); for (String index : concreteIndices) { - Settings indexSettings = state.metaData().index(index).getSettings(); + Settings indexSettings = state.metadata().index(index).getSettings(); if (request.humanReadable()) { - indexSettings = IndexMetaData.addHumanReadableSettings(indexSettings); + indexSettings = IndexMetadata.addHumanReadableSettings(indexSettings); } settingsMapBuilder.put(index, indexSettings); if (request.includeDefaults()) { diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java index 28ff148c5e2..891b4be012a 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java @@ -59,7 +59,7 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte private static final ParseField MAPPINGS = new ParseField("mappings"); - private static final ObjectParser>, String> PARSER = + private static final ObjectParser>, String> PARSER = new ObjectParser<>(MAPPINGS.getPreferredName(), true, HashMap::new); static { @@ -69,13 +69,13 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte final String typeName = p.currentName(); if (p.nextToken() == XContentParser.Token.START_OBJECT) { - final Map typeMapping = new HashMap<>(); + final Map typeMapping = new HashMap<>(); typeMappings.put(typeName, typeMapping); while (p.nextToken() == XContentParser.Token.FIELD_NAME) { final String fieldName = p.currentName(); - final FieldMappingMetaData fieldMappingMetaData = FieldMappingMetaData.fromXContent(p); - typeMapping.put(fieldName, fieldMappingMetaData); + final FieldMappingMetadata fieldMappingMetadata = FieldMappingMetadata.fromXContent(p); + typeMapping.put(fieldName, fieldMappingMetadata); } } else { p.skipChildren(); @@ -85,26 +85,26 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte }, MAPPINGS, ObjectParser.ValueType.OBJECT); } - private final Map>> mappings; + private final Map>> mappings; - GetFieldMappingsResponse(Map>> mappings) { + GetFieldMappingsResponse(Map>> mappings) { this.mappings = mappings; } GetFieldMappingsResponse(StreamInput in) throws IOException { super(in); int size = in.readVInt(); - Map>> indexMapBuilder = new HashMap<>(size); + Map>> indexMapBuilder = new HashMap<>(size); for (int i = 0; i < size; i++) { String index = in.readString(); int typesSize = in.readVInt(); - Map> typeMapBuilder = new HashMap<>(typesSize); + Map> typeMapBuilder = new HashMap<>(typesSize); for (int j = 0; j < typesSize; j++) { String type = in.readString(); int fieldSize = in.readVInt(); - Map fieldMapBuilder = new HashMap<>(fieldSize); + Map fieldMapBuilder = new HashMap<>(fieldSize); for (int k = 0; k < fieldSize; k++) { - fieldMapBuilder.put(in.readString(), new FieldMappingMetaData(in.readString(), in.readBytesReference())); + fieldMapBuilder.put(in.readString(), new FieldMappingMetadata(in.readString(), in.readBytesReference())); } typeMapBuilder.put(type, unmodifiableMap(fieldMapBuilder)); } @@ -115,7 +115,7 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte } /** returns the retrieved field mapping. The return map keys are index, type, field (as specified in the request). */ - public Map>> mappings() { + public Map>> mappings() { return mappings; } @@ -123,14 +123,14 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte * Returns the mappings of a specific field. * * @param field field name as specified in the {@link GetFieldMappingsRequest} - * @return FieldMappingMetaData for the requested field or null if not found. + * @return FieldMappingMetadata for the requested field or null if not found. */ - public FieldMappingMetaData fieldMappings(String index, String type, String field) { - Map> indexMapping = mappings.get(index); + public FieldMappingMetadata fieldMappings(String index, String type, String field) { + Map> indexMapping = mappings.get(index); if (indexMapping == null) { return null; } - Map typeMapping = indexMapping.get(type); + Map typeMapping = indexMapping.get(type); if (typeMapping == null) { return null; } @@ -143,13 +143,13 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte DEFAULT_INCLUDE_TYPE_NAME_POLICY); builder.startObject(); - for (Map.Entry>> indexEntry : mappings.entrySet()) { + for (Map.Entry>> indexEntry : mappings.entrySet()) { builder.startObject(indexEntry.getKey()); builder.startObject(MAPPINGS.getPreferredName()); if (includeTypeName == false) { - Map mappings = null; - for (Map.Entry> typeEntry : indexEntry.getValue().entrySet()) { + Map mappings = null; + for (Map.Entry> typeEntry : indexEntry.getValue().entrySet()) { if (typeEntry.getKey().equals(MapperService.DEFAULT_MAPPING) == false) { assert mappings == null; mappings = typeEntry.getValue(); @@ -159,7 +159,7 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte addFieldMappingsToBuilder(builder, params, mappings); } } else { - for (Map.Entry> typeEntry : indexEntry.getValue().entrySet()) { + for (Map.Entry> typeEntry : indexEntry.getValue().entrySet()) { builder.startObject(typeEntry.getKey()); addFieldMappingsToBuilder(builder, params, typeEntry.getValue()); builder.endObject(); @@ -175,8 +175,8 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte private void addFieldMappingsToBuilder(XContentBuilder builder, Params params, - Map mappings) throws IOException { - for (Map.Entry fieldEntry : mappings.entrySet()) { + Map mappings) throws IOException { + for (Map.Entry fieldEntry : mappings.entrySet()) { builder.startObject(fieldEntry.getKey()); fieldEntry.getValue().toXContent(builder, params); builder.endObject(); @@ -186,12 +186,12 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte public static GetFieldMappingsResponse fromXContent(XContentParser parser) throws IOException { ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.nextToken(), parser::getTokenLocation); - final Map>> mappings = new HashMap<>(); + final Map>> mappings = new HashMap<>(); if (parser.nextToken() == XContentParser.Token.FIELD_NAME) { while (parser.currentToken() == XContentParser.Token.FIELD_NAME) { final String index = parser.currentName(); - final Map> typeMappings = PARSER.parse(parser, index); + final Map> typeMappings = PARSER.parse(parser, index); mappings.put(index, typeMappings); parser.nextToken(); @@ -201,15 +201,15 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte return new GetFieldMappingsResponse(mappings); } - public static class FieldMappingMetaData implements ToXContentFragment { - public static final FieldMappingMetaData NULL = new FieldMappingMetaData("", BytesArray.EMPTY); + public static class FieldMappingMetadata implements ToXContentFragment { + public static final FieldMappingMetadata NULL = new FieldMappingMetadata("", BytesArray.EMPTY); private static final ParseField FULL_NAME = new ParseField("full_name"); private static final ParseField MAPPING = new ParseField("mapping"); - private static final ConstructingObjectParser PARSER = + private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>("field_mapping_meta_data", true, - a -> new FieldMappingMetaData((String)a[0], (BytesReference)a[1]) + a -> new FieldMappingMetadata((String)a[0], (BytesReference)a[1]) ); static { @@ -226,7 +226,7 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte private String fullName; private BytesReference source; - public FieldMappingMetaData(String fullName, BytesReference source) { + public FieldMappingMetadata(String fullName, BytesReference source) { this.fullName = fullName; this.source = source; } @@ -249,7 +249,7 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte return source; } - public static FieldMappingMetaData fromXContent(XContentParser parser) throws IOException { + public static FieldMappingMetadata fromXContent(XContentParser parser) throws IOException { return PARSER.parse(parser, null); } @@ -268,14 +268,14 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte @Override public String toString() { - return "FieldMappingMetaData{fullName='" + fullName + '\'' + ", source=" + source + '}'; + return "FieldMappingMetadata{fullName='" + fullName + '\'' + ", source=" + source + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof FieldMappingMetaData)) return false; - FieldMappingMetaData that = (FieldMappingMetaData) o; + if (!(o instanceof FieldMappingMetadata)) return false; + FieldMappingMetadata that = (FieldMappingMetadata) o; return Objects.equals(fullName, that.fullName) && Objects.equals(source, that.source); } @@ -289,15 +289,15 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(mappings.size()); - for (Map.Entry>> indexEntry : mappings.entrySet()) { + for (Map.Entry>> indexEntry : mappings.entrySet()) { out.writeString(indexEntry.getKey()); out.writeVInt(indexEntry.getValue().size()); - for (Map.Entry> typeEntry : indexEntry.getValue().entrySet()) { + for (Map.Entry> typeEntry : indexEntry.getValue().entrySet()) { out.writeString(typeEntry.getKey()); out.writeVInt(typeEntry.getValue().size()); - for (Map.Entry fieldEntry : typeEntry.getValue().entrySet()) { + for (Map.Entry fieldEntry : typeEntry.getValue().entrySet()) { out.writeString(fieldEntry.getKey()); - FieldMappingMetaData fieldMapping = fieldEntry.getValue(); + FieldMappingMetadata fieldMapping = fieldEntry.getValue(); out.writeString(fieldMapping.fullName()); out.writeBytesReference(fieldMapping.source); } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponse.java index 67bc8726852..2df9c13cb4b 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponse.java @@ -21,7 +21,7 @@ package org.elasticsearch.action.admin.indices.mapping.get; import com.carrotsearch.hppc.cursors.ObjectObjectCursor; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.cluster.metadata.MappingMetaData; +import org.elasticsearch.cluster.metadata.MappingMetadata; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.Strings; import org.elasticsearch.common.collect.ImmutableOpenMap; @@ -41,43 +41,43 @@ public class GetMappingsResponse extends ActionResponse implements ToXContentFra private static final ParseField MAPPINGS = new ParseField("mappings"); - private ImmutableOpenMap> mappings = ImmutableOpenMap.of(); + private ImmutableOpenMap> mappings = ImmutableOpenMap.of(); - public GetMappingsResponse(ImmutableOpenMap> mappings) { + public GetMappingsResponse(ImmutableOpenMap> mappings) { this.mappings = mappings; } GetMappingsResponse(StreamInput in) throws IOException { super(in); int size = in.readVInt(); - ImmutableOpenMap.Builder> indexMapBuilder = ImmutableOpenMap.builder(); + ImmutableOpenMap.Builder> indexMapBuilder = ImmutableOpenMap.builder(); for (int i = 0; i < size; i++) { String key = in.readString(); int valueSize = in.readVInt(); - ImmutableOpenMap.Builder typeMapBuilder = ImmutableOpenMap.builder(); + ImmutableOpenMap.Builder typeMapBuilder = ImmutableOpenMap.builder(); for (int j = 0; j < valueSize; j++) { - typeMapBuilder.put(in.readString(), new MappingMetaData(in)); + typeMapBuilder.put(in.readString(), new MappingMetadata(in)); } indexMapBuilder.put(key, typeMapBuilder.build()); } mappings = indexMapBuilder.build(); } - public ImmutableOpenMap> mappings() { + public ImmutableOpenMap> mappings() { return mappings; } - public ImmutableOpenMap> getMappings() { + public ImmutableOpenMap> getMappings() { return mappings(); } @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(mappings.size()); - for (ObjectObjectCursor> indexEntry : mappings) { + for (ObjectObjectCursor> indexEntry : mappings) { out.writeString(indexEntry.key); out.writeVInt(indexEntry.value.size()); - for (ObjectObjectCursor typeEntry : indexEntry.value) { + for (ObjectObjectCursor typeEntry : indexEntry.value) { out.writeString(typeEntry.key); typeEntry.value.writeTo(out); } @@ -91,19 +91,19 @@ public class GetMappingsResponse extends ActionResponse implements ToXContentFra assert parser.currentToken() == XContentParser.Token.START_OBJECT; Map parts = parser.map(); - ImmutableOpenMap.Builder> builder = new ImmutableOpenMap.Builder<>(); + ImmutableOpenMap.Builder> builder = new ImmutableOpenMap.Builder<>(); for (Map.Entry entry : parts.entrySet()) { final String indexName = entry.getKey(); assert entry.getValue() instanceof Map : "expected a map as type mapping, but got: " + entry.getValue().getClass(); final Map mapping = (Map) ((Map) entry.getValue()).get(MAPPINGS.getPreferredName()); - ImmutableOpenMap.Builder typeBuilder = new ImmutableOpenMap.Builder<>(); + ImmutableOpenMap.Builder typeBuilder = new ImmutableOpenMap.Builder<>(); for (Map.Entry typeEntry : mapping.entrySet()) { final String typeName = typeEntry.getKey(); assert typeEntry.getValue() instanceof Map : "expected a map as inner type mapping, but got: " + typeEntry.getValue().getClass(); final Map fieldMappings = (Map) typeEntry.getValue(); - MappingMetaData mmd = new MappingMetaData(typeName, fieldMappings); + MappingMetadata mmd = new MappingMetadata(typeName, fieldMappings); typeBuilder.put(typeName, mmd); } builder.put(indexName, typeBuilder.build()); @@ -117,12 +117,12 @@ public class GetMappingsResponse extends ActionResponse implements ToXContentFra boolean includeTypeName = params.paramAsBoolean(BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER, DEFAULT_INCLUDE_TYPE_NAME_POLICY); - for (final ObjectObjectCursor> indexEntry : getMappings()) { + for (final ObjectObjectCursor> indexEntry : getMappings()) { builder.startObject(indexEntry.key); { if (includeTypeName == false) { - MappingMetaData mappings = null; - for (final ObjectObjectCursor typeEntry : indexEntry.value) { + MappingMetadata mappings = null; + for (final ObjectObjectCursor typeEntry : indexEntry.value) { if (typeEntry.key.equals("_default_") == false) { assert mappings == null; mappings = typeEntry.value; @@ -137,7 +137,7 @@ public class GetMappingsResponse extends ActionResponse implements ToXContentFra } else { builder.startObject(MAPPINGS.getPreferredName()); { - for (final ObjectObjectCursor typeEntry : indexEntry.value) { + for (final ObjectObjectCursor typeEntry : indexEntry.value) { builder.field(typeEntry.key, typeEntry.value.sourceAsMap()); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetFieldMappingsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetFieldMappingsAction.java index 5d56601017f..79df765480f 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetFieldMappingsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetFieldMappingsAction.java @@ -90,7 +90,7 @@ public class TransportGetFieldMappingsAction extends HandledTransportAction indexResponses) { - Map>> mergedResponses = new HashMap<>(); + Map>> mergedResponses = new HashMap<>(); for (int i = 0; i < indexResponses.length(); i++) { Object element = indexResponses.get(i); if (element instanceof GetFieldMappingsResponse) { diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetFieldMappingsIndexAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetFieldMappingsIndexAction.java index 61a598c361c..721347d880f 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetFieldMappingsIndexAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetFieldMappingsIndexAction.java @@ -21,7 +21,7 @@ package org.elasticsearch.action.admin.indices.mapping.get; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.Version; -import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetaData; +import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetadata; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.single.shard.TransportSingleShardAction; import org.elasticsearch.cluster.ClusterState; @@ -94,7 +94,7 @@ public class TransportGetFieldMappingsIndexAction assert shardId != null; IndexService indexService = indicesService.indexServiceSafe(shardId.getIndex()); Version indexCreatedVersion = indexService.mapperService().getIndexSettings().getIndexVersionCreated(); - Predicate metadataFieldPredicate = (f) -> indicesService.isMetaDataField(indexCreatedVersion, f); + Predicate metadataFieldPredicate = (f) -> indicesService.isMetadataField(indexCreatedVersion, f); Predicate fieldPredicate = metadataFieldPredicate.or(indicesService.getFieldFilter().apply(shardId.getIndexName())); DocumentMapper mapper = indexService.mapperService().documentMapper(); @@ -112,10 +112,10 @@ public class TransportGetFieldMappingsIndexAction } } - Map> typeMappings = new HashMap<>(); + Map> typeMappings = new HashMap<>(); for (String type : typeIntersection) { DocumentMapper documentMapper = indexService.mapperService().documentMapper(type); - Map fieldMapping = findFieldMappingsByType(fieldPredicate, documentMapper, request); + Map fieldMapping = findFieldMappingsByType(fieldPredicate, documentMapper, request); if (!fieldMapping.isEmpty()) { typeMappings.put(type, fieldMapping); } @@ -170,10 +170,10 @@ public class TransportGetFieldMappingsIndexAction } }; - private static Map findFieldMappingsByType(Predicate fieldPredicate, + private static Map findFieldMappingsByType(Predicate fieldPredicate, DocumentMapper documentMapper, GetFieldMappingsIndexRequest request) { - Map fieldMappings = new HashMap<>(); + Map fieldMappings = new HashMap<>(); final DocumentFieldMappers allFieldMappers = documentMapper.mappers(); for (String field : request.fields()) { if (Regex.isMatchAllPattern(field)) { @@ -193,7 +193,7 @@ public class TransportGetFieldMappingsIndexAction if (fieldMapper != null) { addFieldMapper(fieldPredicate, field, fieldMapper, fieldMappings, request.includeDefaults()); } else if (request.probablySingleFieldRequest()) { - fieldMappings.put(field, FieldMappingMetaData.NULL); + fieldMappings.put(field, FieldMappingMetadata.NULL); } } } @@ -201,7 +201,7 @@ public class TransportGetFieldMappingsIndexAction } private static void addFieldMapper(Predicate fieldPredicate, - String field, Mapper fieldMapper, Map fieldMappings, + String field, Mapper fieldMapper, Map fieldMappings, boolean includeDefaults) { if (fieldMappings.containsKey(field)) { return; @@ -210,7 +210,7 @@ public class TransportGetFieldMappingsIndexAction try { BytesReference bytes = XContentHelper.toXContent(fieldMapper, XContentType.JSON, includeDefaults ? includeDefaultsParams : ToXContent.EMPTY_PARAMS, false); - fieldMappings.put(field, new FieldMappingMetaData(fieldMapper.name(), bytes)); + fieldMappings.put(field, new FieldMappingMetadata(fieldMapper.name(), bytes)); } catch (IOException e) { throw new ElasticsearchException("failed to serialize XContent of field [" + field + "]", e); } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetMappingsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetMappingsAction.java index 6a537624616..c56b30d56d1 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetMappingsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetMappingsAction.java @@ -28,7 +28,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MappingMetaData; +import org.elasticsearch.cluster.metadata.MappingMetadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.inject.Inject; @@ -76,8 +76,8 @@ public class TransportGetMappingsAction extends TransportClusterInfoAction listener) { logger.trace("serving getMapping request based on version {}", state.version()); try { - ImmutableOpenMap> result = - state.metaData().findMappings(concreteIndices, request.types(), indicesService.getFieldFilter()); + ImmutableOpenMap> result = + state.metadata().findMappings(concreteIndices, request.types(), indicesService.getFieldFilter()); listener.onResponse(new GetMappingsResponse(result)); } catch (IOException e) { listener.onFailure(e); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java index 320f094eb12..591f9ceb9a6 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java @@ -32,7 +32,7 @@ import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaDataMappingService; +import org.elasticsearch.cluster.metadata.MetadataMappingService; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; @@ -52,7 +52,7 @@ public class TransportPutMappingAction extends TransportMasterNodeAction requestValidators; @Inject @@ -60,13 +60,13 @@ public class TransportPutMappingAction extends TransportMasterNodeAction requestValidators) { super(PutMappingAction.NAME, transportService, clusterService, threadPool, actionFilters, PutMappingRequest::new, indexNameExpressionResolver); - this.metaDataMappingService = metaDataMappingService; + this.metadataMappingService = metadataMappingService; this.requestValidators = Objects.requireNonNull(requestValidators); } @@ -109,7 +109,7 @@ public class TransportPutMappingAction extends TransportMasterNodeAction() { + metadataMappingService.putMapping(updateRequest, new ActionListener() { @Override public void onResponse(ClusterStateUpdateResponse response) { diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java index d33d862ac59..c30a56c7fe8 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java @@ -31,7 +31,7 @@ import org.elasticsearch.cluster.ack.OpenIndexClusterStateUpdateResponse; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaDataIndexStateService; +import org.elasticsearch.cluster.metadata.MetadataIndexStateService; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; @@ -49,12 +49,12 @@ public class TransportOpenIndexAction extends TransportMasterNodeAction> metConditions, boolean silent) throws Exception { - final MetaData metaData = currentState.metaData(); - validate(metaData, aliasName); - final IndexAbstraction alias = metaData.getIndicesLookup().get(aliasName); - final IndexMetaData indexMetaData = alias.getWriteIndex(); - final AliasMetaData aliasMetaData = indexMetaData.getAliases().get(alias.getName()); - final String sourceProvidedName = indexMetaData.getSettings().get(IndexMetaData.SETTING_INDEX_PROVIDED_NAME, - indexMetaData.getIndex().getName()); - final String sourceIndexName = indexMetaData.getIndex().getName(); + final Metadata metadata = currentState.metadata(); + validate(metadata, aliasName); + final IndexAbstraction alias = metadata.getIndicesLookup().get(aliasName); + final IndexMetadata indexMetadata = alias.getWriteIndex(); + final AliasMetadata aliasMetadata = indexMetadata.getAliases().get(alias.getName()); + final String sourceProvidedName = indexMetadata.getSettings().get(IndexMetadata.SETTING_INDEX_PROVIDED_NAME, + indexMetadata.getIndex().getName()); + final String sourceIndexName = indexMetadata.getIndex().getName(); final String unresolvedName = (newIndexName != null) ? newIndexName : generateRolloverIndexName(sourceProvidedName, indexNameExpressionResolver); final String rolloverIndexName = indexNameExpressionResolver.resolveDateMathExpression(unresolvedName); - final boolean explicitWriteIndex = Boolean.TRUE.equals(aliasMetaData.writeIndex()); - final Boolean isHidden = IndexMetaData.INDEX_HIDDEN_SETTING.exists(createIndexRequest.settings()) ? - IndexMetaData.INDEX_HIDDEN_SETTING.get(createIndexRequest.settings()) : null; + final boolean explicitWriteIndex = Boolean.TRUE.equals(aliasMetadata.writeIndex()); + final Boolean isHidden = IndexMetadata.INDEX_HIDDEN_SETTING.exists(createIndexRequest.settings()) ? + IndexMetadata.INDEX_HIDDEN_SETTING.get(createIndexRequest.settings()) : null; createIndexService.validateIndexName(rolloverIndexName, currentState); // fails if the index already exists - checkNoDuplicatedAliasInIndexTemplate(metaData, rolloverIndexName, aliasName, isHidden); + checkNoDuplicatedAliasInIndexTemplate(metadata, rolloverIndexName, aliasName, isHidden); CreateIndexClusterStateUpdateRequest createIndexClusterStateRequest = prepareCreateIndexRequest(unresolvedName, rolloverIndexName, createIndexRequest); ClusterState newState = createIndexService.applyCreateIndexRequest(currentState, createIndexClusterStateRequest, silent); newState = indexAliasesService.applyAliasActions(newState, - rolloverAliasToNewIndex(sourceIndexName, rolloverIndexName, explicitWriteIndex, aliasMetaData.isHidden(), aliasName)); + rolloverAliasToNewIndex(sourceIndexName, rolloverIndexName, explicitWriteIndex, aliasMetadata.isHidden(), aliasName)); RolloverInfo rolloverInfo = new RolloverInfo(aliasName, metConditions, threadPool.absoluteTimeInMillis()); newState = ClusterState.builder(newState) - .metaData(MetaData.builder(newState.metaData()) - .put(IndexMetaData.builder(newState.metaData().index(sourceIndexName)) + .metadata(Metadata.builder(newState.metadata()) + .put(IndexMetadata.builder(newState.metadata().index(sourceIndexName)) .putRolloverInfo(rolloverInfo))).build(); return new RolloverResult(rolloverIndexName, sourceIndexName, newState); @@ -163,10 +163,10 @@ public class MetaDataRolloverService { * the rollover alias will point to multiple indices. This causes indexing requests to be rejected. * To avoid this, we make sure that there is no duplicated alias in index templates before creating a new index. */ - static void checkNoDuplicatedAliasInIndexTemplate(MetaData metaData, String rolloverIndexName, String rolloverRequestAlias, + static void checkNoDuplicatedAliasInIndexTemplate(Metadata metadata, String rolloverIndexName, String rolloverRequestAlias, @Nullable Boolean isHidden) { - final List matchedTemplates = findTemplates(metaData, rolloverIndexName, isHidden); - for (IndexTemplateMetaData template : matchedTemplates) { + final List matchedTemplates = findTemplates(metadata, rolloverIndexName, isHidden); + for (IndexTemplateMetadata template : matchedTemplates) { if (template.aliases().containsKey(rolloverRequestAlias)) { throw new IllegalArgumentException(String.format(Locale.ROOT, "Rollover alias [%s] can point to multiple indices, found duplicated alias [%s] in index template [%s]", @@ -175,8 +175,8 @@ public class MetaDataRolloverService { } } - static void validate(MetaData metaData, String aliasName) { - final IndexAbstraction indexAbstraction = metaData.getIndicesLookup().get(aliasName); + static void validate(Metadata metadata, String aliasName) { + final IndexAbstraction indexAbstraction = metadata.getIndicesLookup().get(aliasName); if (indexAbstraction == null) { throw new IllegalArgumentException("source alias does not exist"); } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java index 150f081738e..6b7affbae93 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java @@ -33,9 +33,9 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateUpdateTask; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.inject.Inject; @@ -59,14 +59,14 @@ import java.util.stream.Collectors; */ public class TransportRolloverAction extends TransportMasterNodeAction { - private final MetaDataRolloverService rolloverService; + private final MetadataRolloverService rolloverService; private final ActiveShardsObserver activeShardsObserver; private final Client client; @Inject public TransportRolloverAction(TransportService transportService, ClusterService clusterService, ThreadPool threadPool, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, - MetaDataRolloverService rolloverService, Client client) { + MetadataRolloverService rolloverService, Client client) { super(RolloverAction.NAME, transportService, clusterService, threadPool, actionFilters, RolloverRequest::new, indexNameExpressionResolver); this.rolloverService = rolloverService; @@ -102,11 +102,11 @@ public class TransportRolloverAction extends TransportMasterNodeAction listener) throws Exception { - MetaDataRolloverService.RolloverResult preResult = + MetadataRolloverService.RolloverResult preResult = rolloverService.rolloverClusterState(state, rolloverRequest.getAlias(), rolloverRequest.getNewIndexName(), rolloverRequest.getCreateIndexRequest(), Collections.emptyList(), true); - MetaData metaData = state.metaData(); + Metadata metadata = state.metadata(); String sourceIndexName = preResult.sourceIndexName; String rolloverIndexName = preResult.rolloverIndexName; IndicesStatsRequest statsRequest = new IndicesStatsRequest().indices(rolloverRequest.getAlias()) @@ -119,7 +119,7 @@ public class TransportRolloverAction extends TransportMasterNodeAction conditionResults = evaluateConditions(rolloverRequest.getConditions().values(), - metaData.index(sourceIndexName), statsResponse); + metadata.index(sourceIndexName), statsResponse); if (rolloverRequest.isDryRun()) { listener.onResponse( @@ -133,7 +133,7 @@ public class TransportRolloverAction extends TransportMasterNodeAction evaluateConditions(final Collection> conditions, @Nullable final DocsStats docsStats, - @Nullable final IndexMetaData metaData) { - if (metaData == null) { + @Nullable final IndexMetadata metadata) { + if (metadata == null) { return conditions.stream().collect(Collectors.toMap(Condition::toString, cond -> false)); } final long numDocs = docsStats == null ? 0 : docsStats.getCount(); final long indexSize = docsStats == null ? 0 : docsStats.getTotalSizeInBytes(); - final Condition.Stats stats = new Condition.Stats(numDocs, metaData.getCreationDate(), new ByteSizeValue(indexSize)); + final Condition.Stats stats = new Condition.Stats(numDocs, metadata.getCreationDate(), new ByteSizeValue(indexSize)); return conditions.stream() .map(condition -> condition.evaluate(stats)) .collect(Collectors.toMap(result -> result.condition.toString(), result -> result.matched)); } static Map evaluateConditions(final Collection> conditions, - @Nullable final IndexMetaData metaData, + @Nullable final IndexMetadata metadata, @Nullable final IndicesStatsResponse statsResponse) { - if (metaData == null) { + if (metadata == null) { return conditions.stream().collect(Collectors.toMap(Condition::toString, cond -> false)); } else { final DocsStats docsStats = Optional.ofNullable(statsResponse) - .map(stats -> stats.getIndex(metaData.getIndex().getName())) + .map(stats -> stats.getIndex(metadata.getIndex().getName())) .map(indexStats -> indexStats.getPrimaries().getDocs()) .orElse(null); - return evaluateConditions(conditions, docsStats, metaData); + return evaluateConditions(conditions, docsStats, metadata); } } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/TransportGetSettingsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/TransportGetSettingsAction.java index d2f730c0dfb..f48ad2771e0 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/TransportGetSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/TransportGetSettingsAction.java @@ -25,7 +25,7 @@ import org.elasticsearch.action.support.master.TransportMasterNodeReadAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.collect.ImmutableOpenMap; @@ -87,14 +87,14 @@ public class TransportGetSettingsAction extends TransportMasterNodeReadAction indexToSettingsBuilder = ImmutableOpenMap.builder(); ImmutableOpenMap.Builder indexToDefaultSettingsBuilder = ImmutableOpenMap.builder(); for (Index concreteIndex : concreteIndices) { - IndexMetaData indexMetaData = state.getMetaData().index(concreteIndex); - if (indexMetaData == null) { + IndexMetadata indexMetadata = state.getMetadata().index(concreteIndex); + if (indexMetadata == null) { continue; } - Settings indexSettings = settingsFilter.filter(indexMetaData.getSettings()); + Settings indexSettings = settingsFilter.filter(indexMetadata.getSettings()); if (request.humanReadable()) { - indexSettings = IndexMetaData.addHumanReadableSettings(indexSettings); + indexSettings = IndexMetadata.addHumanReadableSettings(indexSettings); } if (isFilteredRequest(request)) { diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/TransportUpdateSettingsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/TransportUpdateSettingsAction.java index 7462f8a78f1..b8981b4b73c 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/TransportUpdateSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/TransportUpdateSettingsAction.java @@ -30,9 +30,9 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaDataUpdateSettingsService; +import org.elasticsearch.cluster.metadata.MetadataUpdateSettingsService; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; @@ -46,11 +46,11 @@ public class TransportUpdateSettingsAction extends TransportMasterNodeAction implements if (targetIndexRequest.settings().getByPrefix("index.sort.").isEmpty() == false) { validationException = addValidationError("can't override index sort when resizing an index", validationException); } - if (type == ResizeType.SPLIT && IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.exists(targetIndexRequest.settings()) == false) { + if (type == ResizeType.SPLIT && IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.exists(targetIndexRequest.settings()) == false) { validationException = addValidationError("index.number_of_shards is required for split operations", validationException); } assert copySettings == null || copySettings; diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeAction.java index 3a3b59a47e6..f30777c999d 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeAction.java @@ -30,9 +30,9 @@ import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaDataCreateIndexService; +import org.elasticsearch.cluster.metadata.MetadataCreateIndexService; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; @@ -55,19 +55,19 @@ import java.util.function.IntFunction; * Main class to initiate resizing (shrink / split) an index into a new index */ public class TransportResizeAction extends TransportMasterNodeAction { - private final MetaDataCreateIndexService createIndexService; + private final MetadataCreateIndexService createIndexService; private final Client client; @Inject public TransportResizeAction(TransportService transportService, ClusterService clusterService, - ThreadPool threadPool, MetaDataCreateIndexService createIndexService, + ThreadPool threadPool, MetadataCreateIndexService createIndexService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, Client client) { this(ResizeAction.NAME, transportService, clusterService, threadPool, createIndexService, actionFilters, indexNameExpressionResolver, client); } protected TransportResizeAction(String actionName, TransportService transportService, ClusterService clusterService, - ThreadPool threadPool, MetaDataCreateIndexService createIndexService, + ThreadPool threadPool, MetadataCreateIndexService createIndexService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, Client client) { super(actionName, transportService, clusterService, threadPool, actionFilters, ResizeRequest::new, indexNameExpressionResolver); this.createIndexService = createIndexService; @@ -117,28 +117,28 @@ public class TransportResizeAction extends TransportMasterNodeAction perShardDocStats, String sourceIndexName, String targetIndexName) { final CreateIndexRequest targetIndex = resizeRequest.getTargetIndexRequest(); - final IndexMetaData metaData = state.metaData().index(sourceIndexName); - if (metaData == null) { + final IndexMetadata metadata = state.metadata().index(sourceIndexName); + if (metadata == null) { throw new IndexNotFoundException(sourceIndexName); } final Settings targetIndexSettings = Settings.builder().put(targetIndex.settings()) - .normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX).build(); + .normalizePrefix(IndexMetadata.INDEX_SETTING_PREFIX).build(); final int numShards; - if (IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.exists(targetIndexSettings)) { - numShards = IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.get(targetIndexSettings); + if (IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.exists(targetIndexSettings)) { + numShards = IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.get(targetIndexSettings); } else { assert resizeRequest.getResizeType() != ResizeType.SPLIT : "split must specify the number of shards explicitly"; if (resizeRequest.getResizeType() == ResizeType.SHRINK) { numShards = 1; } else { assert resizeRequest.getResizeType() == ResizeType.CLONE; - numShards = metaData.getNumberOfShards(); + numShards = metadata.getNumberOfShards(); } } for (int i = 0; i < numShards; i++) { if (resizeRequest.getResizeType() == ResizeType.SHRINK) { - Set shardIds = IndexMetaData.selectShrinkShards(i, metaData, numShards); + Set shardIds = IndexMetadata.selectShrinkShards(i, metadata, numShards); long count = 0; for (ShardId id : shardIds) { DocsStats docsStats = perShardDocStats.apply(id.id()); @@ -151,25 +151,25 @@ public class TransportResizeAction extends TransportMasterNodeAction listener) { indexTemplateService.removeTemplates( - new MetaDataIndexTemplateService + new MetadataIndexTemplateService .RemoveRequest(request.name()) .masterTimeout(request.masterNodeTimeout()), - new MetaDataIndexTemplateService.RemoveListener() { + new MetadataIndexTemplateService.RemoveListener() { @Override - public void onResponse(MetaDataIndexTemplateService.RemoveResponse response) { + public void onResponse(MetadataIndexTemplateService.RemoveResponse response) { listener.onResponse(new AcknowledgedResponse(response.acknowledged())); } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/TransportDeleteIndexTemplateV2Action.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/TransportDeleteIndexTemplateV2Action.java index 57e596f483d..628215ebc7c 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/TransportDeleteIndexTemplateV2Action.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/TransportDeleteIndexTemplateV2Action.java @@ -29,7 +29,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaDataIndexTemplateService; +import org.elasticsearch.cluster.metadata.MetadataIndexTemplateService; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; @@ -43,11 +43,11 @@ public class TransportDeleteIndexTemplateV2Action private static final Logger logger = LogManager.getLogger(TransportDeleteIndexTemplateV2Action.class); - private final MetaDataIndexTemplateService indexTemplateService; + private final MetadataIndexTemplateService indexTemplateService; @Inject public TransportDeleteIndexTemplateV2Action(TransportService transportService, ClusterService clusterService, - ThreadPool threadPool, MetaDataIndexTemplateService indexTemplateService, + ThreadPool threadPool, MetadataIndexTemplateService indexTemplateService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) { super(DeleteIndexTemplateV2Action.NAME, transportService, clusterService, threadPool, actionFilters, DeleteIndexTemplateV2Action.Request::new, indexNameExpressionResolver); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponse.java index 502f073c0a3..93f1ac6f0bb 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponse.java @@ -19,7 +19,7 @@ package org.elasticsearch.action.admin.indices.template.get; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.cluster.metadata.IndexTemplateMetaData; +import org.elasticsearch.cluster.metadata.IndexTemplateMetadata; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContent; @@ -37,29 +37,29 @@ import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER public class GetIndexTemplatesResponse extends ActionResponse implements ToXContentObject { - private final List indexTemplates; + private final List indexTemplates; public GetIndexTemplatesResponse(StreamInput in) throws IOException { super(in); int size = in.readVInt(); indexTemplates = new ArrayList<>(); for (int i = 0 ; i < size ; i++) { - indexTemplates.add(0, IndexTemplateMetaData.readFrom(in)); + indexTemplates.add(0, IndexTemplateMetadata.readFrom(in)); } } - public GetIndexTemplatesResponse(List indexTemplates) { + public GetIndexTemplatesResponse(List indexTemplates) { this.indexTemplates = indexTemplates; } - public List getIndexTemplates() { + public List getIndexTemplates() { return indexTemplates; } @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(indexTemplates.size()); - for (IndexTemplateMetaData indexTemplate : indexTemplates) { + for (IndexTemplateMetadata indexTemplate : indexTemplates) { indexTemplate.writeTo(out); } } @@ -72,11 +72,11 @@ public class GetIndexTemplatesResponse extends ActionResponse implements ToXCont DEFAULT_INCLUDE_TYPE_NAME_POLICY); builder.startObject(); - for (IndexTemplateMetaData indexTemplateMetaData : getIndexTemplates()) { + for (IndexTemplateMetadata indexTemplateMetadata : getIndexTemplates()) { if (includeTypeName) { - IndexTemplateMetaData.Builder.toXContentWithTypes(indexTemplateMetaData, builder, params); + IndexTemplateMetadata.Builder.toXContentWithTypes(indexTemplateMetadata, builder, params); } else { - IndexTemplateMetaData.Builder.toXContent(indexTemplateMetaData, builder, params); + IndexTemplateMetadata.Builder.toXContent(indexTemplateMetadata, builder, params); } } builder.endObject(); @@ -84,11 +84,11 @@ public class GetIndexTemplatesResponse extends ActionResponse implements ToXCont } public static GetIndexTemplatesResponse fromXContent(XContentParser parser) throws IOException { - final List templates = new ArrayList<>(); + final List templates = new ArrayList<>(); for (XContentParser.Token token = parser.nextToken(); token != XContentParser.Token.END_OBJECT; token = parser.nextToken()) { if (token == XContentParser.Token.FIELD_NAME) { - final IndexTemplateMetaData templateMetaData = IndexTemplateMetaData.Builder.fromXContent(parser, parser.currentName()); - templates.add(templateMetaData); + final IndexTemplateMetadata templateMetadata = IndexTemplateMetadata.Builder.fromXContent(parser, parser.currentName()); + templates.add(templateMetadata); } } return new GetIndexTemplatesResponse(templates); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/TransportGetComponentTemplateAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/TransportGetComponentTemplateAction.java index 250f943a591..14c8bf384cd 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/TransportGetComponentTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/TransportGetComponentTemplateAction.java @@ -67,7 +67,7 @@ public class TransportGetComponentTemplateAction extends @Override protected void masterOperation(GetComponentTemplateAction.Request request, ClusterState state, ActionListener listener) { - Map allTemplates = state.metaData().componentTemplates(); + Map allTemplates = state.metadata().componentTemplates(); // If we did not ask for a specific name, then we return all templates if (request.names().length == 0) { diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/TransportGetIndexTemplateV2Action.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/TransportGetIndexTemplateV2Action.java index ab8589b083a..117e6aff766 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/TransportGetIndexTemplateV2Action.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/TransportGetIndexTemplateV2Action.java @@ -67,7 +67,7 @@ public class TransportGetIndexTemplateV2Action @Override protected void masterOperation(GetIndexTemplateV2Action.Request request, ClusterState state, ActionListener listener) { - Map allTemplates = state.metaData().templatesV2(); + Map allTemplates = state.metadata().templatesV2(); // If we did not ask for a specific name, then we return all templates if (request.names().length == 0) { diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/TransportGetIndexTemplatesAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/TransportGetIndexTemplatesAction.java index 4ad7738986d..b5f6eead464 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/TransportGetIndexTemplatesAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/TransportGetIndexTemplatesAction.java @@ -26,7 +26,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.IndexTemplateMetaData; +import org.elasticsearch.cluster.metadata.IndexTemplateMetadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; @@ -68,24 +68,24 @@ public class TransportGetIndexTemplatesAction extends @Override protected void masterOperation(GetIndexTemplatesRequest request, ClusterState state, ActionListener listener) { - List results; + List results; // If we did not ask for a specific name, then we return all templates if (request.names().length == 0) { - results = Arrays.asList(state.metaData().templates().values().toArray(IndexTemplateMetaData.class)); + results = Arrays.asList(state.metadata().templates().values().toArray(IndexTemplateMetadata.class)); } else { results = new ArrayList<>(); } for (String name : request.names()) { if (Regex.isSimpleMatchPattern(name)) { - for (ObjectObjectCursor entry : state.metaData().templates()) { + for (ObjectObjectCursor entry : state.metadata().templates()) { if (Regex.simpleMatch(name, entry.key)) { results.add(entry.value); } } - } else if (state.metaData().templates().containsKey(name)) { - results.add(state.metaData().templates().get(name)); + } else if (state.metadata().templates().containsKey(name)) { + results.add(state.metadata().templates().get(name)); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/TransportPutComponentTemplateAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/TransportPutComponentTemplateAction.java index 79106243959..b294cd9b30b 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/TransportPutComponentTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/TransportPutComponentTemplateAction.java @@ -27,9 +27,9 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.ComponentTemplate; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaDataIndexTemplateService; +import org.elasticsearch.cluster.metadata.MetadataIndexTemplateService; import org.elasticsearch.cluster.metadata.Template; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; @@ -44,12 +44,12 @@ import java.io.IOException; public class TransportPutComponentTemplateAction extends TransportMasterNodeAction { - private final MetaDataIndexTemplateService indexTemplateService; + private final MetadataIndexTemplateService indexTemplateService; private final IndexScopedSettings indexScopedSettings; @Inject public TransportPutComponentTemplateAction(TransportService transportService, ClusterService clusterService, - ThreadPool threadPool, MetaDataIndexTemplateService indexTemplateService, + ThreadPool threadPool, MetadataIndexTemplateService indexTemplateService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, IndexScopedSettings indexScopedSettings) { super(PutComponentTemplateAction.NAME, transportService, clusterService, threadPool, actionFilters, @@ -81,7 +81,7 @@ public class TransportPutComponentTemplateAction Template template = componentTemplate.template(); // Normalize the index settings if necessary if (template.settings() != null) { - Settings.Builder builder = Settings.builder().put(template.settings()).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX); + Settings.Builder builder = Settings.builder().put(template.settings()).normalizePrefix(IndexMetadata.INDEX_SETTING_PREFIX); Settings settings = builder.build(); indexScopedSettings.validate(settings, true); template = new Template(settings, template.mappings(), template.aliases()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/TransportPutIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/TransportPutIndexTemplateAction.java index 8f278cbe8b4..e2581dd73c4 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/TransportPutIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/TransportPutIndexTemplateAction.java @@ -28,9 +28,9 @@ import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaDataIndexTemplateService; +import org.elasticsearch.cluster.metadata.MetadataIndexTemplateService; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; @@ -48,12 +48,12 @@ public class TransportPutIndexTemplateAction extends TransportMasterNodeAction

{ - private final MetaDataIndexTemplateService indexTemplateService; + private final MetadataIndexTemplateService indexTemplateService; @Inject public TransportPutIndexTemplateV2Action(TransportService transportService, ClusterService clusterService, - ThreadPool threadPool, MetaDataIndexTemplateService indexTemplateService, + ThreadPool threadPool, MetadataIndexTemplateService indexTemplateService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) { super(PutIndexTemplateV2Action.NAME, transportService, clusterService, threadPool, actionFilters, PutIndexTemplateV2Action.Request::new, indexNameExpressionResolver); @@ -77,7 +77,7 @@ public class TransportPutIndexTemplateV2Action Template template = indexTemplate.template(); // Normalize the index settings if necessary if (template.settings() != null) { - Settings.Builder settings = Settings.builder().put(template.settings()).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX); + Settings.Builder settings = Settings.builder().put(template.settings()).normalizePrefix(IndexMetadata.INDEX_SETTING_PREFIX); template = new Template(settings.build(), template.mappings(), template.aliases()); indexTemplate = new IndexTemplateV2(indexTemplate.indexPatterns(), template, indexTemplate.composedOf(), indexTemplate.priority(), indexTemplate.version(), indexTemplate.metadata()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/TransportUpgradeAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/TransportUpgradeAction.java index 3bd28cfc6e2..265af56d6a7 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/TransportUpgradeAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/TransportUpgradeAction.java @@ -30,7 +30,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.routing.IndexRoutingTable; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.ShardRouting; @@ -104,12 +104,12 @@ public class TransportUpgradeAction extends TransportBroadcastByNodeAction> updatedVersions = new HashMap<>(); - MetaData metaData = clusterState.metaData(); + Metadata metadata = clusterState.metadata(); for (Map.Entry> versionEntry : versions.entrySet()) { String index = versionEntry.getKey(); Integer primaryCount = successfulPrimaryShards.get(index); - int expectedPrimaryCount = metaData.index(index).getNumberOfShards(); - if (primaryCount == metaData.index(index).getNumberOfShards()) { + int expectedPrimaryCount = metadata.index(index).getNumberOfShards(); + if (primaryCount == metadata.index(index).getNumberOfShards()) { updatedVersions.put(index, new Tuple<>(versionEntry.getValue().v1(), versionEntry.getValue().v2().toString())); } else { logger.warn("Not updating settings for the index [{}] because upgraded of some primary shards failed - " + diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/TransportUpgradeSettingsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/TransportUpgradeSettingsAction.java index bacbc314d0f..bc3d8a7c8a3 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/TransportUpgradeSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/TransportUpgradeSettingsAction.java @@ -31,7 +31,7 @@ import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.metadata.MetaDataUpdateSettingsService; +import org.elasticsearch.cluster.metadata.MetadataUpdateSettingsService; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; @@ -44,11 +44,11 @@ public class TransportUpgradeSettingsAction extends TransportMasterNodeAction responses = new AtomicArray<>(bulkRequest.requests.size()); boolean hasIndexRequestsWithPipelines = false; - final MetaData metaData = clusterService.state().getMetaData(); + final Metadata metadata = clusterService.state().getMetadata(); final Version minNodeVersion = clusterService.state().getNodes().getMinNodeVersion(); for (DocWriteRequest actionRequest : bulkRequest.requests) { IndexRequest indexRequest = getIndexWriteRequest(actionRequest); if (indexRequest != null) { // Each index request needs to be evaluated, because this method also modifies the IndexRequest - boolean indexRequestHasPipeline = resolvePipelines(actionRequest, indexRequest, metaData); + boolean indexRequestHasPipeline = resolvePipelines(actionRequest, indexRequest, metadata); hasIndexRequestsWithPipelines |= indexRequestHasPipeline; } @@ -274,7 +274,7 @@ public class TransportBulkAction extends HandledTransportAction originalRequest, final IndexRequest indexRequest, final MetaData metaData) { + static boolean resolvePipelines(final DocWriteRequest originalRequest, final IndexRequest indexRequest, final Metadata metadata) { if (indexRequest.isPipelineResolved() == false) { final String requestPipeline = indexRequest.getPipeline(); indexRequest.setPipeline(IngestService.NOOP_PIPELINE_NAME); @@ -282,23 +282,23 @@ public class TransportBulkAction extends HandledTransportAction templates = MetaDataIndexTemplateService.findTemplates(metaData, indexRequest.index(), null); + List templates = MetadataIndexTemplateService.findTemplates(metadata, indexRequest.index(), null); assert (templates != null); // order of templates are highest order first - for (final IndexTemplateMetaData template : templates) { + for (final IndexTemplateMetadata template : templates) { final Settings settings = template.settings(); if (defaultPipeline == null && IndexSettings.DEFAULT_PIPELINE.exists(settings)) { defaultPipeline = IndexSettings.DEFAULT_PIPELINE.get(settings); @@ -417,14 +417,14 @@ public class TransportBulkAction extends HandledTransportAction docWriteRequest = bulkRequest.requests.get(i); //the request can only be null because we set it to null in the previous step, so it gets ignored if (docWriteRequest == null) { continue; } - if (addFailureIfIndexIsUnavailable(docWriteRequest, i, concreteIndices, metaData)) { + if (addFailureIfIndexIsUnavailable(docWriteRequest, i, concreteIndices, metadata)) { continue; } Index concreteIndex = concreteIndices.resolveIfAbsent(docWriteRequest); @@ -433,20 +433,20 @@ public class TransportBulkAction extends HandledTransportAction request, int idx, final ConcreteIndices concreteIndices, - final MetaData metaData) { + final Metadata metadata) { IndexNotFoundException cannotCreate = indicesThatCannotBeCreated.get(request.index()); if (cannotCreate != null) { addFailure(request, idx, cannotCreate); @@ -589,8 +589,8 @@ public class TransportBulkAction extends HandledTransportAction implement } - public void process(Version indexCreatedVersion, @Nullable MappingMetaData mappingMd, String concreteIndex) { + public void process(Version indexCreatedVersion, @Nullable MappingMetadata mappingMd, String concreteIndex) { if (mappingMd != null) { // might as well check for routing here if (mappingMd.routing().required() && routing == null) { @@ -678,8 +678,8 @@ public class IndexRequest extends ReplicatedWriteRequest implement } /* resolve the routing if needed */ - public void resolveRouting(MetaData metaData) { - routing(metaData.resolveWriteIndexRouting(routing, index)); + public void resolveRouting(Metadata metadata) { + routing(metadata.resolveWriteIndexRouting(routing, index)); } public void checkAutoIdWithOpTypeCreateSupportedByVersion(Version version) { diff --git a/server/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineRequest.java b/server/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineRequest.java index 65de150546d..7563ddf278d 100644 --- a/server/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineRequest.java +++ b/server/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineRequest.java @@ -33,7 +33,7 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.index.VersionType; import org.elasticsearch.ingest.ConfigurationUtils; import org.elasticsearch.ingest.IngestDocument; -import org.elasticsearch.ingest.IngestDocument.MetaData; +import org.elasticsearch.ingest.IngestDocument.Metadata; import org.elasticsearch.ingest.IngestService; import org.elasticsearch.ingest.Pipeline; @@ -185,25 +185,25 @@ public class SimulatePipelineRequest extends ActionRequest implements ToXContent Map document = ConfigurationUtils.readMap(null, null, dataMap, Fields.SOURCE); String index = ConfigurationUtils.readStringOrIntProperty(null, null, - dataMap, MetaData.INDEX.getFieldName(), "_index"); - if (dataMap.containsKey(MetaData.TYPE.getFieldName())) { + dataMap, Metadata.INDEX.getFieldName(), "_index"); + if (dataMap.containsKey(Metadata.TYPE.getFieldName())) { deprecationLogger.deprecatedAndMaybeLog("simulate_pipeline_with_types", "[types removal] specifying _type in pipeline simulation requests is deprecated"); } String type = ConfigurationUtils.readStringOrIntProperty(null, null, - dataMap, MetaData.TYPE.getFieldName(), "_doc"); + dataMap, Metadata.TYPE.getFieldName(), "_doc"); String id = ConfigurationUtils.readStringOrIntProperty(null, null, - dataMap, MetaData.ID.getFieldName(), "_id"); + dataMap, Metadata.ID.getFieldName(), "_id"); String routing = ConfigurationUtils.readOptionalStringOrIntProperty(null, null, - dataMap, MetaData.ROUTING.getFieldName()); + dataMap, Metadata.ROUTING.getFieldName()); Long version = null; - if (dataMap.containsKey(MetaData.VERSION.getFieldName())) { - version = (Long) ConfigurationUtils.readObject(null, null, dataMap, MetaData.VERSION.getFieldName()); + if (dataMap.containsKey(Metadata.VERSION.getFieldName())) { + version = (Long) ConfigurationUtils.readObject(null, null, dataMap, Metadata.VERSION.getFieldName()); } VersionType versionType = null; - if (dataMap.containsKey(MetaData.VERSION_TYPE.getFieldName())) { + if (dataMap.containsKey(Metadata.VERSION_TYPE.getFieldName())) { versionType = VersionType.fromString(ConfigurationUtils.readStringProperty(null, null, dataMap, - MetaData.VERSION_TYPE.getFieldName())); + Metadata.VERSION_TYPE.getFieldName())); } IngestDocument ingestDocument = new IngestDocument(index, type, id, routing, version, versionType, document); diff --git a/server/src/main/java/org/elasticsearch/action/ingest/WriteableIngestDocument.java b/server/src/main/java/org/elasticsearch/action/ingest/WriteableIngestDocument.java index 6331097024c..30ef142a6bb 100644 --- a/server/src/main/java/org/elasticsearch/action/ingest/WriteableIngestDocument.java +++ b/server/src/main/java/org/elasticsearch/action/ingest/WriteableIngestDocument.java @@ -29,7 +29,7 @@ import org.elasticsearch.common.xcontent.ToXContentFragment; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.ingest.IngestDocument; -import org.elasticsearch.ingest.IngestDocument.MetaData; +import org.elasticsearch.ingest.IngestDocument.Metadata; import java.io.IOException; import java.time.ZoneId; @@ -56,29 +56,29 @@ final class WriteableIngestDocument implements Writeable, ToXContentFragment { true, a -> { HashMap sourceAndMetadata = new HashMap<>(); - sourceAndMetadata.put(MetaData.INDEX.getFieldName(), a[0]); - sourceAndMetadata.put(MetaData.TYPE.getFieldName(), a[1]); - sourceAndMetadata.put(MetaData.ID.getFieldName(), a[2]); + sourceAndMetadata.put(Metadata.INDEX.getFieldName(), a[0]); + sourceAndMetadata.put(Metadata.TYPE.getFieldName(), a[1]); + sourceAndMetadata.put(Metadata.ID.getFieldName(), a[2]); if (a[3] != null) { - sourceAndMetadata.put(MetaData.ROUTING.getFieldName(), a[3]); + sourceAndMetadata.put(Metadata.ROUTING.getFieldName(), a[3]); } if (a[4] != null) { - sourceAndMetadata.put(MetaData.VERSION.getFieldName(), a[4]); + sourceAndMetadata.put(Metadata.VERSION.getFieldName(), a[4]); } if (a[5] != null) { - sourceAndMetadata.put(MetaData.VERSION_TYPE.getFieldName(), a[5]); + sourceAndMetadata.put(Metadata.VERSION_TYPE.getFieldName(), a[5]); } sourceAndMetadata.putAll((Map)a[6]); return new WriteableIngestDocument(new IngestDocument(sourceAndMetadata, (Map)a[7])); } ); static { - INGEST_DOC_PARSER.declareString(constructorArg(), new ParseField(MetaData.INDEX.getFieldName())); - INGEST_DOC_PARSER.declareString(constructorArg(), new ParseField(MetaData.TYPE.getFieldName())); - INGEST_DOC_PARSER.declareString(constructorArg(), new ParseField(MetaData.ID.getFieldName())); - INGEST_DOC_PARSER.declareString(optionalConstructorArg(), new ParseField(MetaData.ROUTING.getFieldName())); - INGEST_DOC_PARSER.declareLong(optionalConstructorArg(), new ParseField(MetaData.VERSION.getFieldName())); - INGEST_DOC_PARSER.declareString(optionalConstructorArg(), new ParseField(MetaData.VERSION_TYPE.getFieldName())); + INGEST_DOC_PARSER.declareString(constructorArg(), new ParseField(Metadata.INDEX.getFieldName())); + INGEST_DOC_PARSER.declareString(constructorArg(), new ParseField(Metadata.TYPE.getFieldName())); + INGEST_DOC_PARSER.declareString(constructorArg(), new ParseField(Metadata.ID.getFieldName())); + INGEST_DOC_PARSER.declareString(optionalConstructorArg(), new ParseField(Metadata.ROUTING.getFieldName())); + INGEST_DOC_PARSER.declareLong(optionalConstructorArg(), new ParseField(Metadata.VERSION.getFieldName())); + INGEST_DOC_PARSER.declareString(optionalConstructorArg(), new ParseField(Metadata.VERSION_TYPE.getFieldName())); INGEST_DOC_PARSER.declareObject(constructorArg(), (p, c) -> p.map(), new ParseField(SOURCE_FIELD)); INGEST_DOC_PARSER.declareObject( constructorArg(), @@ -134,8 +134,8 @@ final class WriteableIngestDocument implements Writeable, ToXContentFragment { @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(DOC_FIELD); - Map metadataMap = ingestDocument.getMetadata(); - for (Map.Entry metadata : metadataMap.entrySet()) { + Map metadataMap = ingestDocument.getMetadata(); + for (Map.Entry metadata : metadataMap.entrySet()) { if (metadata.getValue() != null) { builder.field(metadata.getKey().getFieldName(), metadata.getValue().toString()); } diff --git a/server/src/main/java/org/elasticsearch/action/main/TransportMainAction.java b/server/src/main/java/org/elasticsearch/action/main/TransportMainAction.java index f6290f58a0b..e40e0e474fc 100644 --- a/server/src/main/java/org/elasticsearch/action/main/TransportMainAction.java +++ b/server/src/main/java/org/elasticsearch/action/main/TransportMainAction.java @@ -50,6 +50,6 @@ public class TransportMainAction extends HandledTransportAction shardRouting : indexRoutingTable.getShards()) { if (waitForActiveShards.enoughShardsActive(shardRouting.value) == false) { diff --git a/server/src/main/java/org/elasticsearch/action/support/replication/ReplicationResponse.java b/server/src/main/java/org/elasticsearch/action/support/replication/ReplicationResponse.java index f9c1b11d1d4..73cda9298c8 100644 --- a/server/src/main/java/org/elasticsearch/action/support/replication/ReplicationResponse.java +++ b/server/src/main/java/org/elasticsearch/action/support/replication/ReplicationResponse.java @@ -23,7 +23,7 @@ import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.ShardOperationFailedException; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -328,7 +328,7 @@ public class ReplicationResponse extends ActionResponse { parser.skipChildren(); // skip potential inner arrays for forward compatibility } } - return new Failure(new ShardId(shardIndex, IndexMetaData.INDEX_UUID_NA_VALUE, shardId), nodeId, reason, status, primary); + return new Failure(new ShardId(shardIndex, IndexMetadata.INDEX_UUID_NA_VALUE, shardId), nodeId, reason, status, primary); } } } diff --git a/server/src/main/java/org/elasticsearch/action/support/replication/TransportBroadcastReplicationAction.java b/server/src/main/java/org/elasticsearch/action/support/replication/TransportBroadcastReplicationAction.java index 8ffc3cb9224..b9d83d4299e 100644 --- a/server/src/main/java/org/elasticsearch/action/support/replication/TransportBroadcastReplicationAction.java +++ b/server/src/main/java/org/elasticsearch/action/support/replication/TransportBroadcastReplicationAction.java @@ -30,7 +30,7 @@ import org.elasticsearch.action.support.broadcast.BroadcastRequest; import org.elasticsearch.action.support.broadcast.BroadcastResponse; import org.elasticsearch.action.support.broadcast.BroadcastShardOperationFailedException; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.routing.IndexShardRoutingTable; import org.elasticsearch.cluster.service.ClusterService; @@ -90,7 +90,7 @@ public abstract class TransportBroadcastReplicationAction shardIds = new ArrayList<>(); String[] concreteIndices = indexNameExpressionResolver.concreteIndexNames(clusterState, request); for (String index : concreteIndices) { - IndexMetaData indexMetaData = clusterState.metaData().getIndices().get(index); - if (indexMetaData != null) { + IndexMetadata indexMetadata = clusterState.metadata().getIndices().get(index); + if (indexMetadata != null) { for (IntObjectCursor shardRouting : clusterState.getRoutingTable().indicesRouting().get(index).getShards()) { shardIds.add(shardRouting.value.shardId()); diff --git a/server/src/main/java/org/elasticsearch/action/support/replication/TransportReplicationAction.java b/server/src/main/java/org/elasticsearch/action/support/replication/TransportReplicationAction.java index b515f3d16dd..039b002b1ca 100644 --- a/server/src/main/java/org/elasticsearch/action/support/replication/TransportReplicationAction.java +++ b/server/src/main/java/org/elasticsearch/action/support/replication/TransportReplicationAction.java @@ -40,7 +40,7 @@ import org.elasticsearch.cluster.ClusterStateObserver; import org.elasticsearch.cluster.action.shard.ShardStateAction; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.AllocationId; import org.elasticsearch.cluster.routing.ShardRouting; @@ -167,14 +167,14 @@ public abstract class TransportReplicationAction< * Resolves derived values in the request. For example, the target shard id of the incoming request, if not set at request construction. * Additional processing or validation of the request should be done here. * - * @param indexMetaData index metadata of the concrete index this request is going to operate on + * @param indexMetadata index metadata of the concrete index this request is going to operate on * @param request the request to resolve */ - protected void resolveRequest(final IndexMetaData indexMetaData, final Request request) { + protected void resolveRequest(final IndexMetadata indexMetadata, final Request request) { if (request.waitForActiveShards() == ActiveShardCount.DEFAULT) { // if the wait for active shard count has not been set in the request, // resolve it from the index settings - request.waitForActiveShards(indexMetaData.getWaitForActiveShards()); + request.waitForActiveShards(indexMetadata.getWaitForActiveShards()); } } @@ -307,9 +307,9 @@ public abstract class TransportReplicationAction< void runWithPrimaryShardReference(final PrimaryShardReference primaryShardReference) { try { final ClusterState clusterState = clusterService.state(); - final IndexMetaData indexMetaData = clusterState.metaData().getIndexSafe(primaryShardReference.routingEntry().index()); + final IndexMetadata indexMetadata = clusterState.metadata().getIndexSafe(primaryShardReference.routingEntry().index()); - final ClusterBlockException blockException = blockExceptions(clusterState, indexMetaData.getIndex().getName()); + final ClusterBlockException blockException = blockExceptions(clusterState, indexMetadata.getIndex().getName()); if (blockException != null) { logger.trace("cluster is blocked, action failed on primary", blockException); throw blockException; @@ -634,8 +634,8 @@ public abstract class TransportReplicationAction< finishAsFailed(blockException); } } else { - final IndexMetaData indexMetaData = state.metaData().index(request.shardId().getIndex()); - if (indexMetaData == null) { + final IndexMetadata indexMetadata = state.metadata().index(request.shardId().getIndex()); + if (indexMetadata == null) { // ensure that the cluster state on the node is at least as high as the node that decided that the index was there if (state.version() < request.routedBasedOnClusterVersion()) { logger.trace("failed to find index [{}] for request [{}] despite sender thinking it would be here. " + @@ -651,15 +651,15 @@ public abstract class TransportReplicationAction< } } - if (indexMetaData.getState() == IndexMetaData.State.CLOSE) { - finishAsFailed(new IndexClosedException(indexMetaData.getIndex())); + if (indexMetadata.getState() == IndexMetadata.State.CLOSE) { + finishAsFailed(new IndexClosedException(indexMetadata.getIndex())); return; } if (request.waitForActiveShards() == ActiveShardCount.DEFAULT) { // if the wait for active shard count has not been set in the request, // resolve it from the index settings - request.waitForActiveShards(indexMetaData.getWaitForActiveShards()); + request.waitForActiveShards(indexMetadata.getWaitForActiveShards()); } assert request.waitForActiveShards() != ActiveShardCount.DEFAULT : "request waitForActiveShards must be set in resolveRequest"; @@ -679,21 +679,21 @@ public abstract class TransportReplicationAction< } final DiscoveryNode node = state.nodes().get(primary.currentNodeId()); if (primary.currentNodeId().equals(state.nodes().getLocalNodeId())) { - performLocalAction(state, primary, node, indexMetaData); + performLocalAction(state, primary, node, indexMetadata); } else { performRemoteAction(state, primary, node); } } } - private void performLocalAction(ClusterState state, ShardRouting primary, DiscoveryNode node, IndexMetaData indexMetaData) { + private void performLocalAction(ClusterState state, ShardRouting primary, DiscoveryNode node, IndexMetadata indexMetadata) { setPhase(task, "waiting_on_primary"); if (logger.isTraceEnabled()) { logger.trace("send action [{}] to local primary [{}] for request [{}] with cluster state version [{}] to [{}] ", transportPrimaryAction, request.shardId(), request, state.version(), primary.currentNodeId()); } performAction(node, transportPrimaryAction, true, - new ConcreteShardRequest<>(request, primary.allocationId().getId(), indexMetaData.primaryTerm(primary.id()))); + new ConcreteShardRequest<>(request, primary.allocationId().getId(), indexMetadata.primaryTerm(primary.id()))); } private void performRemoteAction(ClusterState state, ShardRouting primary, DiscoveryNode node) { diff --git a/server/src/main/java/org/elasticsearch/action/termvectors/TransportMultiTermVectorsAction.java b/server/src/main/java/org/elasticsearch/action/termvectors/TransportMultiTermVectorsAction.java index 20514733aff..4c5b93ceef9 100644 --- a/server/src/main/java/org/elasticsearch/action/termvectors/TransportMultiTermVectorsAction.java +++ b/server/src/main/java/org/elasticsearch/action/termvectors/TransportMultiTermVectorsAction.java @@ -65,9 +65,9 @@ public class TransportMultiTermVectorsAction extends HandledTransportAction shardRequests = new HashMap<>(); for (int i = 0; i < request.requests.size(); i++) { TermVectorsRequest termVectorsRequest = request.requests.get(i); - termVectorsRequest.routing(clusterState.metaData().resolveIndexRouting(termVectorsRequest.routing(), + termVectorsRequest.routing(clusterState.metadata().resolveIndexRouting(termVectorsRequest.routing(), termVectorsRequest.index())); - if (!clusterState.metaData().hasConcreteIndex(termVectorsRequest.index())) { + if (!clusterState.metadata().hasConcreteIndex(termVectorsRequest.index())) { responses.set(i, new MultiTermVectorsItemResponse(null, new MultiTermVectorsResponse.Failure(termVectorsRequest.index(), termVectorsRequest.type(), termVectorsRequest.id(), new IndexNotFoundException(termVectorsRequest.index())))); @@ -75,7 +75,7 @@ public class TransportMultiTermVectorsAction extends HandledTransportAction indicesCreated() { - if (!metaDataChanged()) { + if (!metadataChanged()) { return Collections.emptyList(); } List created = null; - for (ObjectCursor cursor : state.metaData().indices().keys()) { + for (ObjectCursor cursor : state.metadata().indices().keys()) { String index = cursor.value; - if (!previousState.metaData().hasIndex(index)) { + if (!previousState.metadata().hasIndex(index)) { if (created == null) { created = new ArrayList<>(); } @@ -143,8 +143,8 @@ public class ClusterChangedEvent { * the previous cluster state and the new cluster state. Note that this is an object * reference equality test, not an equals test. */ - public boolean metaDataChanged() { - return state.metaData() != previousState.metaData(); + public boolean metadataChanged() { + return state.metadata() != previousState.metadata(); } /** @@ -152,22 +152,22 @@ public class ClusterChangedEvent { * between the previous cluster state and the new cluster state. custom meta data types are * returned iff they have been added, updated or removed between the previous and the current state */ - public Set changedCustomMetaDataSet() { + public Set changedCustomMetadataSet() { Set result = new HashSet<>(); - ImmutableOpenMap currentCustoms = state.metaData().customs(); - ImmutableOpenMap previousCustoms = previousState.metaData().customs(); + ImmutableOpenMap currentCustoms = state.metadata().customs(); + ImmutableOpenMap previousCustoms = previousState.metadata().customs(); if (currentCustoms.equals(previousCustoms) == false) { - for (ObjectObjectCursor currentCustomMetaData : currentCustoms) { + for (ObjectObjectCursor currentCustomMetadata : currentCustoms) { // new custom md added or existing custom md changed - if (previousCustoms.containsKey(currentCustomMetaData.key) == false - || currentCustomMetaData.value.equals(previousCustoms.get(currentCustomMetaData.key)) == false) { - result.add(currentCustomMetaData.key); + if (previousCustoms.containsKey(currentCustomMetadata.key) == false + || currentCustomMetadata.value.equals(previousCustoms.get(currentCustomMetadata.key)) == false) { + result.add(currentCustomMetadata.key); } } // existing custom md deleted - for (ObjectObjectCursor previousCustomMetaData : previousCustoms) { - if (currentCustoms.containsKey(previousCustomMetaData.key) == false) { - result.add(previousCustomMetaData.key); + for (ObjectObjectCursor previousCustomMetadata : previousCustoms) { + if (currentCustoms.containsKey(previousCustomMetadata.key) == false) { + result.add(previousCustomMetadata.key); } } } @@ -175,15 +175,15 @@ public class ClusterChangedEvent { } /** - * Returns true iff the {@link IndexMetaData} for a given index + * Returns true iff the {@link IndexMetadata} for a given index * has changed between the previous cluster state and the new cluster state. * Note that this is an object reference equality test, not an equals test. */ - public static boolean indexMetaDataChanged(IndexMetaData metaData1, IndexMetaData metaData2) { - assert metaData1 != null && metaData2 != null; + public static boolean indexMetadataChanged(IndexMetadata metadata1, IndexMetadata metadata2) { + assert metadata1 != null && metadata2 != null; // no need to check on version, since disco modules will make sure to use the // same instance if its a version match - return metaData1 != metaData2; + return metadata1 != metadata2; } /** @@ -238,8 +238,8 @@ public class ClusterChangedEvent { * elected that has never been part of the cluster before. */ public boolean isNewCluster() { - final String prevClusterUUID = previousState.metaData().clusterUUID(); - final String currClusterUUID = state.metaData().clusterUUID(); + final String prevClusterUUID = previousState.metadata().clusterUUID(); + final String currClusterUUID = state.metadata().clusterUUID(); return prevClusterUUID.equals(currClusterUUID) == false; } @@ -253,13 +253,13 @@ public class ClusterChangedEvent { // See test DiscoveryWithServiceDisruptionsIT.testIndicesDeleted() // See discussion on https://github.com/elastic/elasticsearch/pull/9952 and // https://github.com/elastic/elasticsearch/issues/11665 - if (metaDataChanged() == false || isNewCluster()) { + if (metadataChanged() == false || isNewCluster()) { return Collections.emptyList(); } List deleted = null; - for (ObjectCursor cursor : previousState.metaData().indices().values()) { - IndexMetaData index = cursor.value; - IndexMetaData current = state.metaData().index(index.getIndex()); + for (ObjectCursor cursor : previousState.metadata().indices().values()) { + IndexMetadata index = cursor.value; + IndexMetadata current = state.metadata().index(index.getIndex()); if (current == null) { if (deleted == null) { deleted = new ArrayList<>(); @@ -277,7 +277,7 @@ public class ClusterChangedEvent { // to re-process the same deletes or process deletes about indices it never knew about. This is not // an issue because there are safeguards in place in the delete store operation in case the index // folder doesn't exist on the file system. - List tombstones = state.metaData().indexGraveyard().getTombstones(); + List tombstones = state.metadata().indexGraveyard().getTombstones(); return tombstones.stream().map(IndexGraveyard.Tombstone::getIndex).collect(Collectors.toList()); } diff --git a/server/src/main/java/org/elasticsearch/cluster/ClusterModule.java b/server/src/main/java/org/elasticsearch/cluster/ClusterModule.java index e17c876b72c..76f2ea40977 100644 --- a/server/src/main/java/org/elasticsearch/cluster/ClusterModule.java +++ b/server/src/main/java/org/elasticsearch/cluster/ClusterModule.java @@ -27,14 +27,14 @@ import org.elasticsearch.cluster.metadata.DataStreamMetadata; import org.elasticsearch.cluster.metadata.IndexGraveyard; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.metadata.IndexTemplateV2Metadata; -import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.cluster.metadata.MetaDataDeleteIndexService; -import org.elasticsearch.cluster.metadata.MetaDataIndexAliasesService; -import org.elasticsearch.cluster.metadata.MetaDataIndexStateService; -import org.elasticsearch.cluster.metadata.MetaDataIndexTemplateService; -import org.elasticsearch.cluster.metadata.MetaDataMappingService; -import org.elasticsearch.cluster.metadata.MetaDataUpdateSettingsService; -import org.elasticsearch.cluster.metadata.RepositoriesMetaData; +import org.elasticsearch.cluster.metadata.Metadata; +import org.elasticsearch.cluster.metadata.MetadataDeleteIndexService; +import org.elasticsearch.cluster.metadata.MetadataIndexAliasesService; +import org.elasticsearch.cluster.metadata.MetadataIndexStateService; +import org.elasticsearch.cluster.metadata.MetadataIndexTemplateService; +import org.elasticsearch.cluster.metadata.MetadataMappingService; +import org.elasticsearch.cluster.metadata.MetadataUpdateSettingsService; +import org.elasticsearch.cluster.metadata.RepositoriesMetadata; import org.elasticsearch.cluster.routing.DelayedAllocationService; import org.elasticsearch.cluster.routing.allocation.AllocationService; import org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator; @@ -71,10 +71,10 @@ import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.common.xcontent.NamedXContentRegistry; import org.elasticsearch.gateway.GatewayAllocator; import org.elasticsearch.ingest.IngestMetadata; -import org.elasticsearch.persistent.PersistentTasksCustomMetaData; +import org.elasticsearch.persistent.PersistentTasksCustomMetadata; import org.elasticsearch.persistent.PersistentTasksNodeService; import org.elasticsearch.plugins.ClusterPlugin; -import org.elasticsearch.script.ScriptMetaData; +import org.elasticsearch.script.ScriptMetadata; import org.elasticsearch.tasks.Task; import org.elasticsearch.tasks.TaskResultsService; @@ -127,24 +127,24 @@ public class ClusterModule extends AbstractModule { registerClusterCustom(entries, RepositoryCleanupInProgress.TYPE, RepositoryCleanupInProgress::new, RepositoryCleanupInProgress::readDiffFrom); // Metadata - registerMetaDataCustom(entries, RepositoriesMetaData.TYPE, RepositoriesMetaData::new, RepositoriesMetaData::readDiffFrom); - registerMetaDataCustom(entries, IngestMetadata.TYPE, IngestMetadata::new, IngestMetadata::readDiffFrom); - registerMetaDataCustom(entries, ScriptMetaData.TYPE, ScriptMetaData::new, ScriptMetaData::readDiffFrom); - registerMetaDataCustom(entries, IndexGraveyard.TYPE, IndexGraveyard::new, IndexGraveyard::readDiffFrom); - registerMetaDataCustom(entries, PersistentTasksCustomMetaData.TYPE, PersistentTasksCustomMetaData::new, - PersistentTasksCustomMetaData::readDiffFrom); - registerMetaDataCustom(entries, ComponentTemplateMetadata.TYPE, ComponentTemplateMetadata::new, + registerMetadataCustom(entries, RepositoriesMetadata.TYPE, RepositoriesMetadata::new, RepositoriesMetadata::readDiffFrom); + registerMetadataCustom(entries, IngestMetadata.TYPE, IngestMetadata::new, IngestMetadata::readDiffFrom); + registerMetadataCustom(entries, ScriptMetadata.TYPE, ScriptMetadata::new, ScriptMetadata::readDiffFrom); + registerMetadataCustom(entries, IndexGraveyard.TYPE, IndexGraveyard::new, IndexGraveyard::readDiffFrom); + registerMetadataCustom(entries, PersistentTasksCustomMetadata.TYPE, PersistentTasksCustomMetadata::new, + PersistentTasksCustomMetadata::readDiffFrom); + registerMetadataCustom(entries, ComponentTemplateMetadata.TYPE, ComponentTemplateMetadata::new, ComponentTemplateMetadata::readDiffFrom); - registerMetaDataCustom(entries, IndexTemplateV2Metadata.TYPE, IndexTemplateV2Metadata::new, + registerMetadataCustom(entries, IndexTemplateV2Metadata.TYPE, IndexTemplateV2Metadata::new, IndexTemplateV2Metadata::readDiffFrom); - registerMetaDataCustom(entries, DataStreamMetadata.TYPE, DataStreamMetadata::new, DataStreamMetadata::readDiffFrom); + registerMetadataCustom(entries, DataStreamMetadata.TYPE, DataStreamMetadata::new, DataStreamMetadata::readDiffFrom); // Task Status (not Diffable) entries.add(new Entry(Task.Status.class, PersistentTasksNodeService.Status.NAME, PersistentTasksNodeService.Status::new)); return entries; } static final Set PRE_6_3_METADATA_CUSTOMS_WHITE_LIST = Collections.unmodifiableSet(Sets.newHashSet( - IndexGraveyard.TYPE, IngestMetadata.TYPE, RepositoriesMetaData.TYPE, ScriptMetaData.TYPE)); + IndexGraveyard.TYPE, IngestMetadata.TYPE, RepositoriesMetadata.TYPE, ScriptMetadata.TYPE)); static final Set PRE_6_3_CLUSTER_CUSTOMS_WHITE_LIST = Collections.unmodifiableSet(Sets.newHashSet( RestoreInProgress.TYPE, SnapshotDeletionsInProgress.TYPE, SnapshotsInProgress.TYPE)); @@ -163,33 +163,33 @@ public class ClusterModule extends AbstractModule { builder.removeCustom(name); } }); - final MetaData.Builder metaBuilder = MetaData.builder(clusterState.metaData()); - clusterState.metaData().customs().keysIt().forEachRemaining(name -> { + final Metadata.Builder metaBuilder = Metadata.builder(clusterState.metadata()); + clusterState.metadata().customs().keysIt().forEachRemaining(name -> { if (PRE_6_3_METADATA_CUSTOMS_WHITE_LIST.contains(name) == false) { metaBuilder.removeCustom(name); } }); - return builder.metaData(metaBuilder).build(); + return builder.metadata(metaBuilder).build(); } public static List getNamedXWriteables() { List entries = new ArrayList<>(); // Metadata - entries.add(new NamedXContentRegistry.Entry(MetaData.Custom.class, new ParseField(RepositoriesMetaData.TYPE), - RepositoriesMetaData::fromXContent)); - entries.add(new NamedXContentRegistry.Entry(MetaData.Custom.class, new ParseField(IngestMetadata.TYPE), + entries.add(new NamedXContentRegistry.Entry(Metadata.Custom.class, new ParseField(RepositoriesMetadata.TYPE), + RepositoriesMetadata::fromXContent)); + entries.add(new NamedXContentRegistry.Entry(Metadata.Custom.class, new ParseField(IngestMetadata.TYPE), IngestMetadata::fromXContent)); - entries.add(new NamedXContentRegistry.Entry(MetaData.Custom.class, new ParseField(ScriptMetaData.TYPE), - ScriptMetaData::fromXContent)); - entries.add(new NamedXContentRegistry.Entry(MetaData.Custom.class, new ParseField(IndexGraveyard.TYPE), + entries.add(new NamedXContentRegistry.Entry(Metadata.Custom.class, new ParseField(ScriptMetadata.TYPE), + ScriptMetadata::fromXContent)); + entries.add(new NamedXContentRegistry.Entry(Metadata.Custom.class, new ParseField(IndexGraveyard.TYPE), IndexGraveyard::fromXContent)); - entries.add(new NamedXContentRegistry.Entry(MetaData.Custom.class, new ParseField(PersistentTasksCustomMetaData.TYPE), - PersistentTasksCustomMetaData::fromXContent)); - entries.add(new NamedXContentRegistry.Entry(MetaData.Custom.class, new ParseField(ComponentTemplateMetadata.TYPE), + entries.add(new NamedXContentRegistry.Entry(Metadata.Custom.class, new ParseField(PersistentTasksCustomMetadata.TYPE), + PersistentTasksCustomMetadata::fromXContent)); + entries.add(new NamedXContentRegistry.Entry(Metadata.Custom.class, new ParseField(ComponentTemplateMetadata.TYPE), ComponentTemplateMetadata::fromXContent)); - entries.add(new NamedXContentRegistry.Entry(MetaData.Custom.class, new ParseField(IndexTemplateV2Metadata.TYPE), + entries.add(new NamedXContentRegistry.Entry(Metadata.Custom.class, new ParseField(IndexTemplateV2Metadata.TYPE), IndexTemplateV2Metadata::fromXContent)); - entries.add(new NamedXContentRegistry.Entry(MetaData.Custom.class, new ParseField(DataStreamMetadata.TYPE), + entries.add(new NamedXContentRegistry.Entry(Metadata.Custom.class, new ParseField(DataStreamMetadata.TYPE), DataStreamMetadata::fromXContent)); return entries; } @@ -199,9 +199,9 @@ public class ClusterModule extends AbstractModule { registerCustom(entries, ClusterState.Custom.class, name, reader, diffReader); } - private static void registerMetaDataCustom(List entries, String name, Reader reader, + private static void registerMetadataCustom(List entries, String name, Reader reader, Reader diffReader) { - registerCustom(entries, MetaData.Custom.class, name, reader, diffReader); + registerCustom(entries, Metadata.Custom.class, name, reader, diffReader); } private static void registerCustom(List entries, Class category, String name, @@ -282,12 +282,12 @@ public class ClusterModule extends AbstractModule { bind(AllocationService.class).toInstance(allocationService); bind(ClusterService.class).toInstance(clusterService); bind(NodeConnectionsService.class).asEagerSingleton(); - bind(MetaDataDeleteIndexService.class).asEagerSingleton(); - bind(MetaDataIndexStateService.class).asEagerSingleton(); - bind(MetaDataMappingService.class).asEagerSingleton(); - bind(MetaDataIndexAliasesService.class).asEagerSingleton(); - bind(MetaDataUpdateSettingsService.class).asEagerSingleton(); - bind(MetaDataIndexTemplateService.class).asEagerSingleton(); + bind(MetadataDeleteIndexService.class).asEagerSingleton(); + bind(MetadataIndexStateService.class).asEagerSingleton(); + bind(MetadataMappingService.class).asEagerSingleton(); + bind(MetadataIndexAliasesService.class).asEagerSingleton(); + bind(MetadataUpdateSettingsService.class).asEagerSingleton(); + bind(MetadataIndexTemplateService.class).asEagerSingleton(); bind(IndexNameExpressionResolver.class).toInstance(indexNameExpressionResolver); bind(DelayedAllocationService.class).asEagerSingleton(); bind(ShardStateAction.class).asEagerSingleton(); diff --git a/server/src/main/java/org/elasticsearch/cluster/ClusterState.java b/server/src/main/java/org/elasticsearch/cluster/ClusterState.java index ed60bef2098..a162ce0732c 100644 --- a/server/src/main/java/org/elasticsearch/cluster/ClusterState.java +++ b/server/src/main/java/org/elasticsearch/cluster/ClusterState.java @@ -26,11 +26,11 @@ import org.elasticsearch.Version; import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.cluster.block.ClusterBlock; import org.elasticsearch.cluster.block.ClusterBlocks; -import org.elasticsearch.cluster.coordination.CoordinationMetaData; -import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfiguration; -import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfigExclusion; -import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.coordination.CoordinationMetadata; +import org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfiguration; +import org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfigExclusion; +import org.elasticsearch.cluster.metadata.IndexMetadata; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.IndexRoutingTable; @@ -162,7 +162,7 @@ public class ClusterState implements ToXContentFragment, Diffable private final DiscoveryNodes nodes; - private final MetaData metaData; + private final Metadata metadata; private final ClusterBlocks blocks; @@ -178,17 +178,17 @@ public class ClusterState implements ToXContentFragment, Diffable private volatile RoutingNodes routingNodes; public ClusterState(long version, String stateUUID, ClusterState state) { - this(state.clusterName, version, stateUUID, state.metaData(), state.routingTable(), state.nodes(), state.blocks(), + this(state.clusterName, version, stateUUID, state.metadata(), state.routingTable(), state.nodes(), state.blocks(), state.customs(), -1, false); } - public ClusterState(ClusterName clusterName, long version, String stateUUID, MetaData metaData, RoutingTable routingTable, + public ClusterState(ClusterName clusterName, long version, String stateUUID, Metadata metadata, RoutingTable routingTable, DiscoveryNodes nodes, ClusterBlocks blocks, ImmutableOpenMap customs, int minimumMasterNodesOnPublishingMaster, boolean wasReadFromDiff) { this.version = version; this.stateUUID = stateUUID; this.clusterName = clusterName; - this.metaData = metaData; + this.metadata = metadata; this.routingTable = routingTable; this.nodes = nodes; this.blocks = blocks; @@ -198,7 +198,7 @@ public class ClusterState implements ToXContentFragment, Diffable } public long term() { - return coordinationMetaData().term(); + return coordinationMetadata().term(); } public long version() { @@ -209,10 +209,10 @@ public class ClusterState implements ToXContentFragment, Diffable return version(); } - public long getVersionOrMetaDataVersion() { + public long getVersionOrMetadataVersion() { // When following a Zen1 master, the cluster state version is not guaranteed to increase, so instead it is preferable to use the // metadata version to determine the freshest node. However when following a Zen2 master the cluster state version should be used. - return term() == ZEN1_BWC_TERM ? metaData().version() : version(); + return term() == ZEN1_BWC_TERM ? metadata().version() : version(); } /** @@ -231,16 +231,16 @@ public class ClusterState implements ToXContentFragment, Diffable return nodes(); } - public MetaData metaData() { - return this.metaData; + public Metadata metadata() { + return this.metadata; } - public MetaData getMetaData() { - return metaData(); + public Metadata getMetadata() { + return metadata(); } - public CoordinationMetaData coordinationMetaData() { - return metaData.coordinationMetaData(); + public CoordinationMetadata coordinationMetadata() { + return metadata.coordinationMetadata(); } public RoutingTable routingTable() { @@ -276,15 +276,15 @@ public class ClusterState implements ToXContentFragment, Diffable } public VotingConfiguration getLastAcceptedConfiguration() { - return coordinationMetaData().getLastAcceptedConfiguration(); + return coordinationMetadata().getLastAcceptedConfiguration(); } public VotingConfiguration getLastCommittedConfiguration() { - return coordinationMetaData().getLastCommittedConfiguration(); + return coordinationMetadata().getLastCommittedConfiguration(); } public Set getVotingConfigExclusions() { - return coordinationMetaData().getVotingConfigExclusions(); + return coordinationMetadata().getVotingConfigExclusions(); } /** @@ -318,38 +318,38 @@ public class ClusterState implements ToXContentFragment, Diffable public String toString() { StringBuilder sb = new StringBuilder(); final String TAB = " "; - sb.append("cluster uuid: ").append(metaData.clusterUUID()) - .append(" [committed: ").append(metaData.clusterUUIDCommitted()).append("]").append("\n"); + sb.append("cluster uuid: ").append(metadata.clusterUUID()) + .append(" [committed: ").append(metadata.clusterUUIDCommitted()).append("]").append("\n"); sb.append("version: ").append(version).append("\n"); sb.append("state uuid: ").append(stateUUID).append("\n"); sb.append("from_diff: ").append(wasReadFromDiff).append("\n"); - sb.append("meta data version: ").append(metaData.version()).append("\n"); + sb.append("meta data version: ").append(metadata.version()).append("\n"); sb.append(TAB).append("coordination_metadata:\n"); - sb.append(TAB).append(TAB).append("term: ").append(coordinationMetaData().term()).append("\n"); + sb.append(TAB).append(TAB).append("term: ").append(coordinationMetadata().term()).append("\n"); sb.append(TAB).append(TAB) - .append("last_committed_config: ").append(coordinationMetaData().getLastCommittedConfiguration()).append("\n"); + .append("last_committed_config: ").append(coordinationMetadata().getLastCommittedConfiguration()).append("\n"); sb.append(TAB).append(TAB) - .append("last_accepted_config: ").append(coordinationMetaData().getLastAcceptedConfiguration()).append("\n"); + .append("last_accepted_config: ").append(coordinationMetadata().getLastAcceptedConfiguration()).append("\n"); sb.append(TAB).append(TAB) - .append("voting tombstones: ").append(coordinationMetaData().getVotingConfigExclusions()).append("\n"); - for (IndexMetaData indexMetaData : metaData) { - sb.append(TAB).append(indexMetaData.getIndex()); - sb.append(": v[").append(indexMetaData.getVersion()) - .append("], mv[").append(indexMetaData.getMappingVersion()) - .append("], sv[").append(indexMetaData.getSettingsVersion()) - .append("], av[").append(indexMetaData.getAliasesVersion()) + .append("voting tombstones: ").append(coordinationMetadata().getVotingConfigExclusions()).append("\n"); + for (IndexMetadata indexMetadata : metadata) { + sb.append(TAB).append(indexMetadata.getIndex()); + sb.append(": v[").append(indexMetadata.getVersion()) + .append("], mv[").append(indexMetadata.getMappingVersion()) + .append("], sv[").append(indexMetadata.getSettingsVersion()) + .append("], av[").append(indexMetadata.getAliasesVersion()) .append("]\n"); - for (int shard = 0; shard < indexMetaData.getNumberOfShards(); shard++) { + for (int shard = 0; shard < indexMetadata.getNumberOfShards(); shard++) { sb.append(TAB).append(TAB).append(shard).append(": "); - sb.append("p_term [").append(indexMetaData.primaryTerm(shard)).append("], "); - sb.append("isa_ids ").append(indexMetaData.inSyncAllocationIds(shard)).append("\n"); + sb.append("p_term [").append(indexMetadata.primaryTerm(shard)).append("], "); + sb.append("isa_ids ").append(indexMetadata.inSyncAllocationIds(shard)).append("\n"); } } - if (metaData.customs().isEmpty() == false) { + if (metadata.customs().isEmpty() == false) { sb.append("metadata customs:\n"); - for (final ObjectObjectCursor cursor : metaData.customs()) { + for (final ObjectObjectCursor cursor : metadata.customs()) { final String type = cursor.key; - final MetaData.Custom custom = cursor.value; + final Metadata.Custom custom = cursor.value; sb.append(TAB).append(type).append(": ").append(custom); } sb.append("\n"); @@ -437,7 +437,7 @@ public class ClusterState implements ToXContentFragment, Diffable EnumSet metrics = Metric.parseString(params.param("metric", "_all"), true); // always provide the cluster_uuid as part of the top-level response (also part of the metadata response) - builder.field("cluster_uuid", metaData().clusterUUID()); + builder.field("cluster_uuid", metadata().clusterUUID()); if (metrics.contains(Metric.VERSION)) { builder.field("version", version); @@ -485,7 +485,7 @@ public class ClusterState implements ToXContentFragment, Diffable // meta data if (metrics.contains(Metric.METADATA)) { - metaData.toXContent(builder, params); + metadata.toXContent(builder, params); } // routing table @@ -554,7 +554,7 @@ public class ClusterState implements ToXContentFragment, Diffable private final ClusterName clusterName; private long version = 0; private String uuid = UNKNOWN_UUID; - private MetaData metaData = MetaData.EMPTY_META_DATA; + private Metadata metadata = Metadata.EMPTY_META_DATA; private RoutingTable routingTable = RoutingTable.EMPTY_ROUTING_TABLE; private DiscoveryNodes nodes = DiscoveryNodes.EMPTY_NODES; private ClusterBlocks blocks = ClusterBlocks.EMPTY_CLUSTER_BLOCK; @@ -568,7 +568,7 @@ public class ClusterState implements ToXContentFragment, Diffable this.uuid = state.stateUUID(); this.nodes = state.nodes(); this.routingTable = state.routingTable(); - this.metaData = state.metaData(); + this.metadata = state.metadata(); this.blocks = state.blocks(); this.customs = ImmutableOpenMap.builder(state.customs()); this.minimumMasterNodesOnPublishingMaster = state.minimumMasterNodesOnPublishingMaster; @@ -598,12 +598,12 @@ public class ClusterState implements ToXContentFragment, Diffable return this; } - public Builder metaData(MetaData.Builder metaDataBuilder) { - return metaData(metaDataBuilder.build()); + public Builder metadata(Metadata.Builder metadataBuilder) { + return metadata(metadataBuilder.build()); } - public Builder metaData(MetaData metaData) { - this.metaData = metaData; + public Builder metadata(Metadata metadata) { + this.metadata = metadata; return this; } @@ -662,7 +662,7 @@ public class ClusterState implements ToXContentFragment, Diffable if (UNKNOWN_UUID.equals(uuid)) { uuid = UUIDs.randomBase64UUID(); } - return new ClusterState(clusterName, version, uuid, metaData, routingTable, nodes, blocks, customs.build(), + return new ClusterState(clusterName, version, uuid, metadata, routingTable, nodes, blocks, customs.build(), minimumMasterNodesOnPublishingMaster, fromDiff); } @@ -697,14 +697,14 @@ public class ClusterState implements ToXContentFragment, Diffable Builder builder = new Builder(clusterName); builder.version = in.readLong(); builder.uuid = in.readString(); - builder.metaData = MetaData.readFrom(in); + builder.metadata = Metadata.readFrom(in); builder.routingTable = RoutingTable.readFrom(in); builder.nodes = DiscoveryNodes.readFrom(in, localNode); builder.blocks = new ClusterBlocks(in); int customSize = in.readVInt(); for (int i = 0; i < customSize; i++) { - Custom customIndexMetaData = in.readNamedWriteable(Custom.class); - builder.putCustom(customIndexMetaData.getWriteableName(), customIndexMetaData); + Custom customIndexMetadata = in.readNamedWriteable(Custom.class); + builder.putCustom(customIndexMetadata.getWriteableName(), customIndexMetadata); } builder.minimumMasterNodesOnPublishingMaster = in.getVersion().onOrAfter(Version.V_6_7_0) ? in.readVInt() : -1; return builder.build(); @@ -715,7 +715,7 @@ public class ClusterState implements ToXContentFragment, Diffable clusterName.writeTo(out); out.writeLong(version); out.writeString(stateUUID); - metaData.writeTo(out); + metadata.writeTo(out); routingTable.writeTo(out); nodes.writeTo(out); blocks.writeTo(out); @@ -751,7 +751,7 @@ public class ClusterState implements ToXContentFragment, Diffable private final Diff nodes; - private final Diff metaData; + private final Diff metadata; private final Diff blocks; @@ -766,7 +766,7 @@ public class ClusterState implements ToXContentFragment, Diffable clusterName = after.clusterName; routingTable = after.routingTable.diff(before.routingTable); nodes = after.nodes.diff(before.nodes); - metaData = after.metaData.diff(before.metaData); + metadata = after.metadata.diff(before.metadata); blocks = after.blocks.diff(before.blocks); customs = DiffableUtils.diff(before.customs, after.customs, DiffableUtils.getStringKeySerializer(), CUSTOM_VALUE_SERIALIZER); minimumMasterNodesOnPublishingMaster = after.minimumMasterNodesOnPublishingMaster; @@ -779,7 +779,7 @@ public class ClusterState implements ToXContentFragment, Diffable toVersion = in.readLong(); routingTable = RoutingTable.readDiffFrom(in); nodes = DiscoveryNodes.readDiffFrom(in, localNode); - metaData = MetaData.readDiffFrom(in); + metadata = Metadata.readDiffFrom(in); blocks = ClusterBlocks.readDiffFrom(in); customs = DiffableUtils.readImmutableOpenMapDiff(in, DiffableUtils.getStringKeySerializer(), CUSTOM_VALUE_SERIALIZER); minimumMasterNodesOnPublishingMaster = in.getVersion().onOrAfter(Version.V_6_7_0) ? in.readVInt() : -1; @@ -793,7 +793,7 @@ public class ClusterState implements ToXContentFragment, Diffable out.writeLong(toVersion); routingTable.writeTo(out); nodes.writeTo(out); - metaData.writeTo(out); + metadata.writeTo(out); blocks.writeTo(out); customs.writeTo(out); if (out.getVersion().onOrAfter(Version.V_6_7_0)) { @@ -815,7 +815,7 @@ public class ClusterState implements ToXContentFragment, Diffable builder.version(toVersion); builder.routingTable(routingTable.apply(state.routingTable)); builder.nodes(nodes.apply(state.nodes)); - builder.metaData(metaData.apply(state.metaData)); + builder.metadata(metadata.apply(state.metadata)); builder.blocks(blocks.apply(state.blocks)); builder.customs(customs.apply(state.customs)); builder.minimumMasterNodesOnPublishingMaster(minimumMasterNodesOnPublishingMaster); diff --git a/server/src/main/java/org/elasticsearch/cluster/MergableCustomMetaData.java b/server/src/main/java/org/elasticsearch/cluster/MergableCustomMetadata.java similarity index 88% rename from server/src/main/java/org/elasticsearch/cluster/MergableCustomMetaData.java rename to server/src/main/java/org/elasticsearch/cluster/MergableCustomMetadata.java index 2a0a79ae80a..e79c06c6bc3 100644 --- a/server/src/main/java/org/elasticsearch/cluster/MergableCustomMetaData.java +++ b/server/src/main/java/org/elasticsearch/cluster/MergableCustomMetadata.java @@ -19,16 +19,16 @@ package org.elasticsearch.cluster; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; /** - * Interface to allow merging {@link org.elasticsearch.cluster.metadata.MetaData.Custom}. + * Interface to allow merging {@link org.elasticsearch.cluster.metadata.Metadata.Custom}. * When multiple Mergable Custom metadata of the same type are found (from underlying clusters), the - * Custom metadata can be merged using {@link #merge(MetaData.Custom)}. + * Custom metadata can be merged using {@link #merge(Metadata.Custom)}. * * @param type of custom meta data */ -public interface MergableCustomMetaData { +public interface MergableCustomMetadata { /** * Merges this custom metadata with other, returning either this or other custom metadata. diff --git a/server/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingRefreshAction.java b/server/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingRefreshAction.java index 5b377989c65..f83fdf90fdd 100644 --- a/server/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingRefreshAction.java +++ b/server/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingRefreshAction.java @@ -23,8 +23,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.elasticsearch.action.IndicesRequest; import org.elasticsearch.action.support.IndicesOptions; -import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.cluster.metadata.MetaDataMappingService; +import org.elasticsearch.cluster.metadata.IndexMetadata; +import org.elasticsearch.cluster.metadata.MetadataMappingService; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; @@ -47,12 +47,12 @@ public class NodeMappingRefreshAction { public static final String ACTION_NAME = "internal:cluster/node/mapping/refresh"; private final TransportService transportService; - private final MetaDataMappingService metaDataMappingService; + private final MetadataMappingService metadataMappingService; @Inject - public NodeMappingRefreshAction(TransportService transportService, MetaDataMappingService metaDataMappingService) { + public NodeMappingRefreshAction(TransportService transportService, MetadataMappingService metadataMappingService) { this.transportService = transportService; - this.metaDataMappingService = metaDataMappingService; + this.metadataMappingService = metadataMappingService; transportService.registerRequestHandler(ACTION_NAME, ThreadPool.Names.SAME, NodeMappingRefreshRequest::new, new NodeMappingRefreshTransportHandler()); } @@ -69,7 +69,7 @@ public class NodeMappingRefreshAction { @Override public void messageReceived(NodeMappingRefreshRequest request, TransportChannel channel, Task task) throws Exception { - metaDataMappingService.refreshMapping(request.index(), request.indexUUID()); + metadataMappingService.refreshMapping(request.index(), request.indexUUID()); channel.sendResponse(TransportResponse.Empty.INSTANCE); } } @@ -77,7 +77,7 @@ public class NodeMappingRefreshAction { public static class NodeMappingRefreshRequest extends TransportRequest implements IndicesRequest { private String index; - private String indexUUID = IndexMetaData.INDEX_UUID_NA_VALUE; + private String indexUUID = IndexMetadata.INDEX_UUID_NA_VALUE; private String nodeId; public NodeMappingRefreshRequest(StreamInput in) throws IOException { diff --git a/server/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java b/server/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java index af72dc9f00d..bc5c92ec710 100644 --- a/server/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java +++ b/server/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java @@ -35,7 +35,7 @@ import org.elasticsearch.cluster.ClusterStateTaskListener; import org.elasticsearch.cluster.MasterNodeChangePredicate; import org.elasticsearch.cluster.NotMasterException; import org.elasticsearch.cluster.coordination.FailedToCommitClusterStateException; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.RerouteService; import org.elasticsearch.cluster.routing.ShardRouting; @@ -340,8 +340,8 @@ public class ShardStateAction { List staleShardsToBeApplied = new ArrayList<>(); for (FailedShardEntry task : tasks) { - IndexMetaData indexMetaData = currentState.metaData().index(task.shardId.getIndex()); - if (indexMetaData == null) { + IndexMetadata indexMetadata = currentState.metadata().index(task.shardId.getIndex()); + if (indexMetadata == null) { // tasks that correspond to non-existent indices are marked as successful logger.debug("{} ignoring shard failed task [{}] (unknown index {})", task.shardId, task, task.shardId.getIndex()); @@ -356,12 +356,12 @@ public class ShardStateAction { // This prevents situations where a new primary has already been selected and replication failures from an old stale // primary unnecessarily fail currently active shards. if (task.primaryTerm > 0) { - long currentPrimaryTerm = indexMetaData.primaryTerm(task.shardId.id()); + long currentPrimaryTerm = indexMetadata.primaryTerm(task.shardId.id()); if (currentPrimaryTerm != task.primaryTerm) { assert currentPrimaryTerm > task.primaryTerm : "received a primary term with a higher term than in the " + "current cluster state (received [" + task.primaryTerm + "] but current is [" + currentPrimaryTerm + "])"; logger.debug("{} failing shard failed task [{}] (primary term {} does not match current term {})", task.shardId, - task, task.primaryTerm, indexMetaData.primaryTerm(task.shardId.id())); + task, task.primaryTerm, indexMetadata.primaryTerm(task.shardId.id())); batchResultBuilder.failure(task, new NoLongerPrimaryShardException( task.shardId, "primary term [" + task.primaryTerm + "] did not match current primary term [" + currentPrimaryTerm + "]")); @@ -371,7 +371,7 @@ public class ShardStateAction { ShardRouting matched = currentState.getRoutingTable().getByAllocationId(task.shardId, task.allocationId); if (matched == null) { - Set inSyncAllocationIds = indexMetaData.inSyncAllocationIds(task.shardId.id()); + Set inSyncAllocationIds = indexMetadata.inSyncAllocationIds(task.shardId.id()); // mark shard copies without routing entries that are in in-sync allocations set only as stale if the reason why // they were failed is because a write made it into the primary but not to this copy (which corresponds to // the check "primaryTerm > 0"). @@ -386,7 +386,7 @@ public class ShardStateAction { batchResultBuilder.success(task); } } else { - // failing a shard also possibly marks it as stale (see IndexMetaDataUpdater) + // failing a shard also possibly marks it as stale (see IndexMetadataUpdater) logger.debug("{} failing shard {} (shard failed task: [{}])", task.shardId, matched, task); tasksToBeApplied.add(task); failedShardsToBeApplied.add(new FailedShard(matched, task.message, task.failure, task.markAsStale)); @@ -588,9 +588,9 @@ public class ShardStateAction { builder.success(task); } else { if (matched.primary() && task.primaryTerm > 0) { - final IndexMetaData indexMetaData = currentState.metaData().index(task.shardId.getIndex()); - assert indexMetaData != null; - final long currentPrimaryTerm = indexMetaData.primaryTerm(task.shardId.id()); + final IndexMetadata indexMetadata = currentState.metadata().index(task.shardId.getIndex()); + assert indexMetadata != null; + final long currentPrimaryTerm = indexMetadata.primaryTerm(task.shardId.id()); if (currentPrimaryTerm != task.primaryTerm) { assert currentPrimaryTerm > task.primaryTerm : "received a primary term with a higher term than in the " + "current cluster state (received [" + task.primaryTerm + "] but current is [" + currentPrimaryTerm + "])"; diff --git a/server/src/main/java/org/elasticsearch/cluster/block/ClusterBlocks.java b/server/src/main/java/org/elasticsearch/cluster/block/ClusterBlocks.java index a7c41f64efa..c9191293e60 100644 --- a/server/src/main/java/org/elasticsearch/cluster/block/ClusterBlocks.java +++ b/server/src/main/java/org/elasticsearch/cluster/block/ClusterBlocks.java @@ -21,8 +21,8 @@ package org.elasticsearch.cluster.block; import com.carrotsearch.hppc.cursors.ObjectObjectCursor; import org.elasticsearch.cluster.AbstractDiffable; import org.elasticsearch.cluster.Diff; -import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.cluster.metadata.MetaDataIndexStateService; +import org.elasticsearch.cluster.metadata.IndexMetadata; +import org.elasticsearch.cluster.metadata.MetadataIndexStateService; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.io.stream.StreamInput; @@ -357,33 +357,33 @@ public class ClusterBlocks extends AbstractDiffable { return this; } - public Builder addBlocks(IndexMetaData indexMetaData) { - String indexName = indexMetaData.getIndex().getName(); - if (indexMetaData.getState() == IndexMetaData.State.CLOSE) { - addIndexBlock(indexName, MetaDataIndexStateService.INDEX_CLOSED_BLOCK); + public Builder addBlocks(IndexMetadata indexMetadata) { + String indexName = indexMetadata.getIndex().getName(); + if (indexMetadata.getState() == IndexMetadata.State.CLOSE) { + addIndexBlock(indexName, MetadataIndexStateService.INDEX_CLOSED_BLOCK); } - if (IndexMetaData.INDEX_READ_ONLY_SETTING.get(indexMetaData.getSettings())) { - addIndexBlock(indexName, IndexMetaData.INDEX_READ_ONLY_BLOCK); + if (IndexMetadata.INDEX_READ_ONLY_SETTING.get(indexMetadata.getSettings())) { + addIndexBlock(indexName, IndexMetadata.INDEX_READ_ONLY_BLOCK); } - if (IndexMetaData.INDEX_BLOCKS_READ_SETTING.get(indexMetaData.getSettings())) { - addIndexBlock(indexName, IndexMetaData.INDEX_READ_BLOCK); + if (IndexMetadata.INDEX_BLOCKS_READ_SETTING.get(indexMetadata.getSettings())) { + addIndexBlock(indexName, IndexMetadata.INDEX_READ_BLOCK); } - if (IndexMetaData.INDEX_BLOCKS_WRITE_SETTING.get(indexMetaData.getSettings())) { - addIndexBlock(indexName, IndexMetaData.INDEX_WRITE_BLOCK); + if (IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.get(indexMetadata.getSettings())) { + addIndexBlock(indexName, IndexMetadata.INDEX_WRITE_BLOCK); } - if (IndexMetaData.INDEX_BLOCKS_METADATA_SETTING.get(indexMetaData.getSettings())) { - addIndexBlock(indexName, IndexMetaData.INDEX_METADATA_BLOCK); + if (IndexMetadata.INDEX_BLOCKS_METADATA_SETTING.get(indexMetadata.getSettings())) { + addIndexBlock(indexName, IndexMetadata.INDEX_METADATA_BLOCK); } - if (IndexMetaData.INDEX_BLOCKS_READ_ONLY_ALLOW_DELETE_SETTING.get(indexMetaData.getSettings())) { - addIndexBlock(indexName, IndexMetaData.INDEX_READ_ONLY_ALLOW_DELETE_BLOCK); + if (IndexMetadata.INDEX_BLOCKS_READ_ONLY_ALLOW_DELETE_SETTING.get(indexMetadata.getSettings())) { + addIndexBlock(indexName, IndexMetadata.INDEX_READ_ONLY_ALLOW_DELETE_BLOCK); } return this; } - public Builder updateBlocks(IndexMetaData indexMetaData) { + public Builder updateBlocks(IndexMetadata indexMetadata) { // let's remove all blocks for this index and add them back -- no need to remove all individual blocks.... - indices.remove(indexMetaData.getIndex().getName()); - return addBlocks(indexMetaData); + indices.remove(indexMetadata.getIndex().getName()); + return addBlocks(indexMetadata); } public Builder addGlobalBlock(ClusterBlock block) { diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterBootstrapService.java b/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterBootstrapService.java index 132b128929a..593d1cfb2b6 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterBootstrapService.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterBootstrapService.java @@ -21,7 +21,7 @@ package org.elasticsearch.cluster.coordination; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; -import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfiguration; +import org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfiguration; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.collect.Tuple; diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelper.java b/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelper.java index ee9d3e0468d..f4c7796c5de 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelper.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelper.java @@ -22,7 +22,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.elasticsearch.Version; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfiguration; +import org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfiguration; import org.elasticsearch.cluster.coordination.CoordinationState.VoteCollection; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.Nullable; @@ -142,7 +142,7 @@ public class ClusterFormationFailureHelper { final String discoveryWillContinueDescription = String.format(Locale.ROOT, "discovery will continue using %s from hosts providers and %s from last-known cluster state; " + "node term %d, last-accepted version %d in term %d", - resolvedAddresses, clusterStateNodes, currentTerm, clusterState.getVersionOrMetaDataVersion(), clusterState.term()); + resolvedAddresses, clusterStateNodes, currentTerm, clusterState.getVersionOrMetadataVersion(), clusterState.term()); final String discoveryStateIgnoringQuorum = String.format(Locale.ROOT, "have discovered %s; %s", foundPeers, discoveryWillContinueDescription); @@ -192,7 +192,7 @@ public class ClusterFormationFailureHelper { foundPeers.forEach(voteCollection::addVote); final String isQuorumOrNot = electionStrategy.isElectionQuorum(clusterState.nodes().getLocalNode(), currentTerm, clusterState.term(), - clusterState.getVersionOrMetaDataVersion(), clusterState.getLastCommittedConfiguration(), + clusterState.getVersionOrMetadataVersion(), clusterState.getLastCommittedConfiguration(), clusterState.getLastAcceptedConfiguration(), voteCollection) ? "is a quorum" : "is not a quorum"; diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/CoordinationMetaData.java b/server/src/main/java/org/elasticsearch/cluster/coordination/CoordinationMetadata.java similarity index 94% rename from server/src/main/java/org/elasticsearch/cluster/coordination/CoordinationMetaData.java rename to server/src/main/java/org/elasticsearch/cluster/coordination/CoordinationMetadata.java index e8648b99a6f..7e30dec1a98 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/CoordinationMetaData.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/CoordinationMetadata.java @@ -39,9 +39,9 @@ import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; -public class CoordinationMetaData implements Writeable, ToXContentFragment { +public class CoordinationMetadata implements Writeable, ToXContentFragment { - public static final CoordinationMetaData EMPTY_META_DATA = builder().build(); + public static final CoordinationMetadata EMPTY_META_DATA = builder().build(); private final long term; @@ -78,9 +78,9 @@ public class CoordinationMetaData implements Writeable, ToXContentFragment { return votingTombstones; } - private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>( + private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>( "coordination_metadata", - fields -> new CoordinationMetaData(term(fields), lastCommittedConfig(fields), + fields -> new CoordinationMetadata(term(fields), lastCommittedConfig(fields), lastAcceptedConfig(fields), votingConfigExclusions(fields))); static { PARSER.declareLong(ConstructingObjectParser.constructorArg(), TERM_PARSE_FIELD); @@ -89,7 +89,7 @@ public class CoordinationMetaData implements Writeable, ToXContentFragment { PARSER.declareObjectArray(ConstructingObjectParser.constructorArg(), VotingConfigExclusion.PARSER, VOTING_CONFIG_EXCLUSIONS_FIELD); } - public CoordinationMetaData(long term, VotingConfiguration lastCommittedConfiguration, VotingConfiguration lastAcceptedConfiguration, + public CoordinationMetadata(long term, VotingConfiguration lastCommittedConfiguration, VotingConfiguration lastAcceptedConfiguration, Set votingConfigExclusions) { this.term = term; this.lastCommittedConfiguration = lastCommittedConfiguration; @@ -97,7 +97,7 @@ public class CoordinationMetaData implements Writeable, ToXContentFragment { this.votingConfigExclusions = Collections.unmodifiableSet(new HashSet<>(votingConfigExclusions)); } - public CoordinationMetaData(StreamInput in) throws IOException { + public CoordinationMetadata(StreamInput in) throws IOException { term = in.readLong(); lastCommittedConfiguration = new VotingConfiguration(in); lastAcceptedConfiguration = new VotingConfiguration(in); @@ -108,8 +108,8 @@ public class CoordinationMetaData implements Writeable, ToXContentFragment { return new Builder(); } - public static Builder builder(CoordinationMetaData coordinationMetaData) { - return new Builder(coordinationMetaData); + public static Builder builder(CoordinationMetadata coordinationMetadata) { + return new Builder(coordinationMetadata); } @Override @@ -129,7 +129,7 @@ public class CoordinationMetaData implements Writeable, ToXContentFragment { .field(VOTING_CONFIG_EXCLUSIONS_FIELD.getPreferredName(), votingConfigExclusions); } - public static CoordinationMetaData fromXContent(XContentParser parser) throws IOException { + public static CoordinationMetadata fromXContent(XContentParser parser) throws IOException { return PARSER.parse(parser, null); } @@ -152,9 +152,9 @@ public class CoordinationMetaData implements Writeable, ToXContentFragment { @Override public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof CoordinationMetaData)) return false; + if (!(o instanceof CoordinationMetadata)) return false; - CoordinationMetaData that = (CoordinationMetaData) o; + CoordinationMetadata that = (CoordinationMetadata) o; if (term != that.term) return false; if (!lastCommittedConfiguration.equals(that.lastCommittedConfiguration)) return false; @@ -173,7 +173,7 @@ public class CoordinationMetaData implements Writeable, ToXContentFragment { @Override public String toString() { - return "CoordinationMetaData{" + + return "CoordinationMetadata{" + "term=" + term + ", lastCommittedConfiguration=" + lastCommittedConfiguration + ", lastAcceptedConfiguration=" + lastAcceptedConfiguration + @@ -190,8 +190,8 @@ public class CoordinationMetaData implements Writeable, ToXContentFragment { public Builder() { } - - public Builder(CoordinationMetaData state) { + + public Builder(CoordinationMetadata state) { this.term = state.term; this.lastCommittedConfiguration = state.lastCommittedConfiguration; this.lastAcceptedConfiguration = state.lastAcceptedConfiguration; @@ -223,8 +223,8 @@ public class CoordinationMetaData implements Writeable, ToXContentFragment { return this; } - public CoordinationMetaData build() { - return new CoordinationMetaData(term, lastCommittedConfiguration, lastAcceptedConfiguration, votingConfigExclusions); + public CoordinationMetadata build() { + return new CoordinationMetadata(term, lastCommittedConfiguration, lastAcceptedConfiguration, votingConfigExclusions); } } diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/CoordinationState.java b/server/src/main/java/org/elasticsearch/cluster/coordination/CoordinationState.java index a84891fc838..b27da0b99eb 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/CoordinationState.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/CoordinationState.java @@ -21,8 +21,8 @@ package org.elasticsearch.cluster.coordination; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfiguration; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfiguration; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.node.DiscoveryNode; import java.io.Closeable; @@ -92,8 +92,8 @@ public class CoordinationState { return getLastAcceptedState().version(); } - private long getLastAcceptedVersionOrMetaDataVersion() { - return getLastAcceptedState().getVersionOrMetaDataVersion(); + private long getLastAcceptedVersionOrMetadataVersion() { + return getLastAcceptedState().getVersionOrMetadataVersion(); } public VotingConfiguration getLastCommittedConfiguration() { @@ -205,7 +205,7 @@ public class CoordinationState { publishVotes = new VoteCollection(); return new Join(localNode, startJoinRequest.getSourceNode(), getCurrentTerm(), getLastAcceptedTerm(), - getLastAcceptedVersionOrMetaDataVersion()); + getLastAcceptedVersionOrMetadataVersion()); } /** @@ -238,12 +238,12 @@ public class CoordinationState { " of join higher than current last accepted term " + lastAcceptedTerm); } - if (join.getLastAcceptedTerm() == lastAcceptedTerm && join.getLastAcceptedVersion() > getLastAcceptedVersionOrMetaDataVersion()) { + if (join.getLastAcceptedTerm() == lastAcceptedTerm && join.getLastAcceptedVersion() > getLastAcceptedVersionOrMetadataVersion()) { logger.debug( "handleJoin: ignored join as joiner has a better last accepted version (expected: <=[{}], actual: [{}]) in term {}", - getLastAcceptedVersionOrMetaDataVersion(), join.getLastAcceptedVersion(), lastAcceptedTerm); + getLastAcceptedVersionOrMetadataVersion(), join.getLastAcceptedVersion(), lastAcceptedTerm); throw new CoordinationStateRejectedException("incoming last accepted version " + join.getLastAcceptedVersion() + - " of join higher than current last accepted version " + getLastAcceptedVersionOrMetaDataVersion() + " of join higher than current last accepted version " + getLastAcceptedVersionOrMetadataVersion() + " in term " + lastAcceptedTerm); } @@ -487,28 +487,28 @@ public class CoordinationState { */ default void markLastAcceptedStateAsCommitted() { final ClusterState lastAcceptedState = getLastAcceptedState(); - MetaData.Builder metaDataBuilder = null; + Metadata.Builder metadataBuilder = null; if (lastAcceptedState.getLastAcceptedConfiguration().equals(lastAcceptedState.getLastCommittedConfiguration()) == false) { - final CoordinationMetaData coordinationMetaData = CoordinationMetaData.builder(lastAcceptedState.coordinationMetaData()) + final CoordinationMetadata coordinationMetadata = CoordinationMetadata.builder(lastAcceptedState.coordinationMetadata()) .lastCommittedConfiguration(lastAcceptedState.getLastAcceptedConfiguration()) .build(); - metaDataBuilder = MetaData.builder(lastAcceptedState.metaData()); - metaDataBuilder.coordinationMetaData(coordinationMetaData); + metadataBuilder = Metadata.builder(lastAcceptedState.metadata()); + metadataBuilder.coordinationMetadata(coordinationMetadata); } // if we receive a commit from a Zen1 master that has not recovered its state yet, the cluster uuid might not been known yet. - assert lastAcceptedState.metaData().clusterUUID().equals(MetaData.UNKNOWN_CLUSTER_UUID) == false || + assert lastAcceptedState.metadata().clusterUUID().equals(Metadata.UNKNOWN_CLUSTER_UUID) == false || lastAcceptedState.term() == ZEN1_BWC_TERM : "received cluster state with empty cluster uuid but not Zen1 BWC term: " + lastAcceptedState; - if (lastAcceptedState.metaData().clusterUUID().equals(MetaData.UNKNOWN_CLUSTER_UUID) == false && - lastAcceptedState.metaData().clusterUUIDCommitted() == false) { - if (metaDataBuilder == null) { - metaDataBuilder = MetaData.builder(lastAcceptedState.metaData()); + if (lastAcceptedState.metadata().clusterUUID().equals(Metadata.UNKNOWN_CLUSTER_UUID) == false && + lastAcceptedState.metadata().clusterUUIDCommitted() == false) { + if (metadataBuilder == null) { + metadataBuilder = Metadata.builder(lastAcceptedState.metadata()); } - metaDataBuilder.clusterUUIDCommitted(true); - logger.info("cluster UUID set to [{}]", lastAcceptedState.metaData().clusterUUID()); + metadataBuilder.clusterUUIDCommitted(true); + logger.info("cluster UUID set to [{}]", lastAcceptedState.metadata().clusterUUID()); } - if (metaDataBuilder != null) { - setLastAcceptedState(ClusterState.builder(lastAcceptedState).metaData(metaDataBuilder).build()); + if (metadataBuilder != null) { + setLastAcceptedState(ClusterState.builder(lastAcceptedState).metadata(metadataBuilder).build()); } } diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/Coordinator.java b/server/src/main/java/org/elasticsearch/cluster/coordination/Coordinator.java index 0b7da5ee3e5..c08ab4b292e 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/Coordinator.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/Coordinator.java @@ -33,12 +33,12 @@ import org.elasticsearch.cluster.ClusterStateUpdateTask; import org.elasticsearch.cluster.LocalClusterUpdateTask; import org.elasticsearch.cluster.block.ClusterBlocks; import org.elasticsearch.cluster.coordination.ClusterFormationFailureHelper.ClusterFormationState; -import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfigExclusion; -import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfiguration; +import org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfigExclusion; +import org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfiguration; import org.elasticsearch.cluster.coordination.CoordinationState.VoteCollection; import org.elasticsearch.cluster.coordination.FollowersChecker.FollowerCheckRequest; import org.elasticsearch.cluster.coordination.JoinHelper.InitialJoinAccumulator; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.RerouteService; @@ -314,13 +314,13 @@ public class Coordinator extends AbstractLifecycleComponent implements Discovery final ClusterState localState = coordinationState.get().getLastAcceptedState(); - if (localState.metaData().clusterUUIDCommitted() && - localState.metaData().clusterUUID().equals(publishRequest.getAcceptedState().metaData().clusterUUID()) == false) { + if (localState.metadata().clusterUUIDCommitted() && + localState.metadata().clusterUUID().equals(publishRequest.getAcceptedState().metadata().clusterUUID()) == false) { logger.warn("received cluster state from {} with a different cluster uuid {} than local cluster uuid {}, rejecting", - sourceNode, publishRequest.getAcceptedState().metaData().clusterUUID(), localState.metaData().clusterUUID()); + sourceNode, publishRequest.getAcceptedState().metadata().clusterUUID(), localState.metadata().clusterUUID()); throw new CoordinationStateRejectedException("received cluster state from " + sourceNode + - " with a different cluster uuid " + publishRequest.getAcceptedState().metaData().clusterUUID() + - " than local cluster uuid " + localState.metaData().clusterUUID() + ", rejecting"); + " with a different cluster uuid " + publishRequest.getAcceptedState().metadata().clusterUUID() + + " than local cluster uuid " + localState.metadata().clusterUUID() + ", rejecting"); } if (publishRequest.getAcceptedState().term() > localState.term()) { @@ -393,7 +393,7 @@ public class Coordinator extends AbstractLifecycleComponent implements Discovery // to check our mode again here. if (mode == Mode.CANDIDATE) { if (localNodeMayWinElection(getLastAcceptedState()) == false) { - logger.trace("skip election as local node may not win it: {}", getLastAcceptedState().coordinationMetaData()); + logger.trace("skip election as local node may not win it: {}", getLastAcceptedState().coordinationMetadata()); return; } @@ -657,7 +657,7 @@ public class Coordinator extends AbstractLifecycleComponent implements Discovery private PreVoteResponse getPreVoteResponse() { return new PreVoteResponse(getCurrentTerm(), coordinationState.get().getLastAcceptedTerm(), - coordinationState.get().getLastAcceptedState().getVersionOrMetaDataVersion()); + coordinationState.get().getLastAcceptedState().getVersionOrMetadataVersion()); } // package-visible for testing @@ -694,8 +694,8 @@ public class Coordinator extends AbstractLifecycleComponent implements Discovery peerFinder.setCurrentTerm(getCurrentTerm()); configuredHostsResolver.start(); final ClusterState lastAcceptedState = coordinationState.get().getLastAcceptedState(); - if (lastAcceptedState.metaData().clusterUUIDCommitted()) { - logger.info("cluster UUID [{}]", lastAcceptedState.metaData().clusterUUID()); + if (lastAcceptedState.metadata().clusterUUIDCommitted()) { + logger.info("cluster UUID [{}]", lastAcceptedState.metadata().clusterUUID()); } final VotingConfiguration votingConfiguration = lastAcceptedState.getLastCommittedConfiguration(); if (singleNodeDiscovery && @@ -878,19 +878,19 @@ public class Coordinator extends AbstractLifecycleComponent implements Discovery } logger.info("setting initial configuration to {}", votingConfiguration); - final CoordinationMetaData coordinationMetaData = CoordinationMetaData.builder(currentState.coordinationMetaData()) + final CoordinationMetadata coordinationMetadata = CoordinationMetadata.builder(currentState.coordinationMetadata()) .lastAcceptedConfiguration(votingConfiguration) .lastCommittedConfiguration(votingConfiguration) .build(); - MetaData.Builder metaDataBuilder = MetaData.builder(currentState.metaData()); + Metadata.Builder metadataBuilder = Metadata.builder(currentState.metadata()); // automatically generate a UID for the metadata if we need to - metaDataBuilder.generateClusterUuidIfNeeded(); // TODO generate UUID in bootstrapping tool? - metaDataBuilder.coordinationMetaData(coordinationMetaData); + metadataBuilder.generateClusterUuidIfNeeded(); // TODO generate UUID in bootstrapping tool? + metadataBuilder.coordinationMetadata(coordinationMetadata); - coordinationState.get().setInitialState(ClusterState.builder(currentState).metaData(metaDataBuilder).build()); + coordinationState.get().setInitialState(ClusterState.builder(currentState).metadata(metadataBuilder).build()); assert localNodeMayWinElection(getLastAcceptedState()) : - "initial state does not allow local node to win election: " + getLastAcceptedState().coordinationMetaData(); + "initial state does not allow local node to win election: " + getLastAcceptedState().coordinationMetadata(); preVoteCollector.update(getPreVoteResponse(), null); // pick up the change to last-accepted version startElectionScheduler(); return true; @@ -923,8 +923,8 @@ public class Coordinator extends AbstractLifecycleComponent implements Discovery if (newConfig.equals(clusterState.getLastAcceptedConfiguration()) == false) { assert coordinationState.get().joinVotesHaveQuorumFor(newConfig); - return ClusterState.builder(clusterState).metaData(MetaData.builder(clusterState.metaData()) - .coordinationMetaData(CoordinationMetaData.builder(clusterState.coordinationMetaData()) + return ClusterState.builder(clusterState).metadata(Metadata.builder(clusterState.metadata()) + .coordinationMetadata(CoordinationMetadata.builder(clusterState.coordinationMetadata()) .lastAcceptedConfiguration(newConfig).build())).build(); } return clusterState; @@ -1202,7 +1202,7 @@ public class Coordinator extends AbstractLifecycleComponent implements Discovery if (localNodeMayWinElection(lastAcceptedState) == false) { logger.trace("skip prevoting as local node may not win election: {}", - lastAcceptedState.coordinationMetaData()); + lastAcceptedState.coordinationMetadata()); return; } diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/DetachClusterCommand.java b/server/src/main/java/org/elasticsearch/cluster/coordination/DetachClusterCommand.java index 994c2c194c7..d9007d0276d 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/DetachClusterCommand.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/DetachClusterCommand.java @@ -21,7 +21,7 @@ package org.elasticsearch.cluster.coordination; import joptsimple.OptionSet; import org.elasticsearch.cli.Terminal; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.env.Environment; import org.elasticsearch.gateway.PersistedClusterStateService; @@ -56,7 +56,7 @@ public class DetachClusterCommand extends ElasticsearchNodeCommand { terminal.println(Terminal.Verbosity.VERBOSE, "Loading cluster state"); final ClusterState oldClusterState = loadTermAndClusterState(persistedClusterStateService, env).v2(); final ClusterState newClusterState = ClusterState.builder(oldClusterState) - .metaData(updateMetaData(oldClusterState.metaData())).build(); + .metadata(updateMetadata(oldClusterState.metadata())).build(); terminal.println(Terminal.Verbosity.VERBOSE, "[old cluster state = " + oldClusterState + ", new cluster state = " + newClusterState + "]"); @@ -70,14 +70,14 @@ public class DetachClusterCommand extends ElasticsearchNodeCommand { } // package-private for tests - static MetaData updateMetaData(MetaData oldMetaData) { - final CoordinationMetaData coordinationMetaData = CoordinationMetaData.builder() - .lastAcceptedConfiguration(CoordinationMetaData.VotingConfiguration.MUST_JOIN_ELECTED_MASTER) - .lastCommittedConfiguration(CoordinationMetaData.VotingConfiguration.MUST_JOIN_ELECTED_MASTER) + static Metadata updateMetadata(Metadata oldMetadata) { + final CoordinationMetadata coordinationMetadata = CoordinationMetadata.builder() + .lastAcceptedConfiguration(CoordinationMetadata.VotingConfiguration.MUST_JOIN_ELECTED_MASTER) + .lastCommittedConfiguration(CoordinationMetadata.VotingConfiguration.MUST_JOIN_ELECTED_MASTER) .term(0) .build(); - return MetaData.builder(oldMetaData) - .coordinationMetaData(coordinationMetaData) + return Metadata.builder(oldMetadata) + .coordinationMetadata(coordinationMetadata) .clusterUUIDCommitted(false) .build(); } diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/DiscoveryUpgradeService.java b/server/src/main/java/org/elasticsearch/cluster/coordination/DiscoveryUpgradeService.java index a549d0dde81..cdb72a97120 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/DiscoveryUpgradeService.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/DiscoveryUpgradeService.java @@ -25,7 +25,7 @@ import org.elasticsearch.Version; import org.elasticsearch.action.ActionListener; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfiguration; +import org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfiguration; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.io.stream.StreamInput; @@ -126,7 +126,7 @@ public class DiscoveryUpgradeService { assert lastKnownLeader.isPresent() == false || Coordinator.isZen1Node(lastKnownLeader.get()) : lastKnownLeader; // if there was a leader and it's not a old node then we must have been bootstrapped - final Settings dynamicSettings = lastAcceptedClusterState.metaData().settings(); + final Settings dynamicSettings = lastAcceptedClusterState.metadata().settings(); final int minimumMasterNodes = DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.exists(dynamicSettings) ? DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.get(dynamicSettings) : lastAcceptedClusterState.getMinimumMasterNodesOnPublishingMaster(); diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/ElasticsearchNodeCommand.java b/server/src/main/java/org/elasticsearch/cluster/coordination/ElasticsearchNodeCommand.java index 4783102cc41..e383e559ad4 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/ElasticsearchNodeCommand.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/ElasticsearchNodeCommand.java @@ -33,7 +33,7 @@ import org.elasticsearch.cli.UserException; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.Diff; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.ClusterSettings; @@ -44,7 +44,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.env.Environment; import org.elasticsearch.env.NodeEnvironment; -import org.elasticsearch.env.NodeMetaData; +import org.elasticsearch.env.NodeMetadata; import org.elasticsearch.gateway.PersistedClusterStateService; import java.io.IOException; @@ -79,8 +79,8 @@ public abstract class ElasticsearchNodeCommand extends EnvironmentAwareCommand { @Override public T parseNamedObject(Class categoryClass, String name, XContentParser parser, C context) throws IOException { // Currently, two unknown top-level objects are present - if (MetaData.Custom.class.isAssignableFrom(categoryClass)) { - return (T) new UnknownMetaDataCustom(name, parser.mapOrdered()); + if (Metadata.Custom.class.isAssignableFrom(categoryClass)) { + return (T) new UnknownMetadataCustom(name, parser.mapOrdered()); } if (Condition.class.isAssignableFrom(categoryClass)) { // The parsing for conditions is a bit weird as these represent JSON primitives (strings or numbers) @@ -108,12 +108,12 @@ public abstract class ElasticsearchNodeCommand extends EnvironmentAwareCommand { } public static PersistedClusterStateService createPersistedClusterStateService(Settings settings, Path[] dataPaths) throws IOException { - final NodeMetaData nodeMetaData = PersistedClusterStateService.nodeMetaData(dataPaths); - if (nodeMetaData == null) { + final NodeMetadata nodeMetadata = PersistedClusterStateService.nodeMetadata(dataPaths); + if (nodeMetadata == null) { throw new ElasticsearchException(NO_NODE_METADATA_FOUND_MSG); } - String nodeId = nodeMetaData.nodeId(); + String nodeId = nodeMetadata.nodeId(); return new PersistedClusterStateService(dataPaths, nodeId, namedXContentRegistry, BigArrays.NON_RECYCLING_INSTANCE, new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS), () -> 0L); } @@ -121,7 +121,7 @@ public abstract class ElasticsearchNodeCommand extends EnvironmentAwareCommand { public static ClusterState clusterState(Environment environment, PersistedClusterStateService.OnDiskState onDiskState) { return ClusterState.builder(ClusterName.CLUSTER_NAME_SETTING.get(environment.settings())) .version(onDiskState.lastAcceptedVersion) - .metaData(onDiskState.metaData) + .metadata(onDiskState.metadata) .build(); } @@ -206,23 +206,23 @@ public abstract class ElasticsearchNodeCommand extends EnvironmentAwareCommand { return parser; } - public static class UnknownMetaDataCustom implements MetaData.Custom { + public static class UnknownMetadataCustom implements Metadata.Custom { private final String name; private final Map contents; - public UnknownMetaDataCustom(String name, Map contents) { + public UnknownMetadataCustom(String name, Map contents) { this.name = name; this.contents = contents; } @Override - public EnumSet context() { - return EnumSet.of(MetaData.XContentContext.API, MetaData.XContentContext.GATEWAY); + public EnumSet context() { + return EnumSet.of(Metadata.XContentContext.API, Metadata.XContentContext.GATEWAY); } @Override - public Diff diff(MetaData.Custom previousState) { + public Diff diff(Metadata.Custom previousState) { assert false; throw new UnsupportedOperationException(); } diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/ElectionStrategy.java b/server/src/main/java/org/elasticsearch/cluster/coordination/ElectionStrategy.java index b9e00cd52fc..d8a8e5e0186 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/ElectionStrategy.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/ElectionStrategy.java @@ -18,7 +18,7 @@ */ package org.elasticsearch.cluster.coordination; -import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfiguration; +import org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfiguration; import org.elasticsearch.cluster.coordination.CoordinationState.VoteCollection; import org.elasticsearch.cluster.node.DiscoveryNode; diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/JoinHelper.java b/server/src/main/java/org/elasticsearch/cluster/coordination/JoinHelper.java index 4dc629ad8c4..6c35afa9e03 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/JoinHelper.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/JoinHelper.java @@ -29,7 +29,7 @@ import org.elasticsearch.cluster.ClusterStateTaskConfig; import org.elasticsearch.cluster.ClusterStateTaskListener; import org.elasticsearch.cluster.NotMasterException; import org.elasticsearch.cluster.coordination.Coordinator.Mode; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.RerouteService; import org.elasticsearch.cluster.routing.allocation.AllocationService; @@ -115,10 +115,10 @@ public class JoinHelper { final long currentTerm = currentTermSupplier.getAsLong(); if (currentState.term() != currentTerm) { - final CoordinationMetaData coordinationMetaData = - CoordinationMetaData.builder(currentState.coordinationMetaData()).term(currentTerm).build(); - final MetaData metaData = MetaData.builder(currentState.metaData()).coordinationMetaData(coordinationMetaData).build(); - currentState = ClusterState.builder(currentState).metaData(metaData).build(); + final CoordinationMetadata coordinationMetadata = + CoordinationMetadata.builder(currentState.coordinationMetadata()).term(currentTerm).build(); + final Metadata metadata = Metadata.builder(currentState.metadata()).coordinationMetadata(coordinationMetadata).build(); + currentState = ClusterState.builder(currentState).metadata(metadata).build(); } return super.execute(currentState, joiningTasks); } @@ -146,11 +146,11 @@ public class JoinHelper { ThreadPool.Names.GENERIC, ValidateJoinRequest::new, (request, channel, task) -> { final ClusterState localState = currentStateSupplier.get(); - if (localState.metaData().clusterUUIDCommitted() && - localState.metaData().clusterUUID().equals(request.getState().metaData().clusterUUID()) == false) { + if (localState.metadata().clusterUUIDCommitted() && + localState.metadata().clusterUUID().equals(request.getState().metadata().clusterUUID()) == false) { throw new CoordinationStateRejectedException("join validation on cluster state" + - " with a different cluster uuid " + request.getState().metaData().clusterUUID() + - " than local cluster uuid " + localState.metaData().clusterUUID() + ", rejecting"); + " with a different cluster uuid " + request.getState().metadata().clusterUUID() + + " than local cluster uuid " + localState.metadata().clusterUUID() + ", rejecting"); } joinValidators.forEach(action -> action.accept(transportService.getLocalNode(), request.getState())); channel.sendResponse(Empty.INSTANCE); @@ -160,11 +160,11 @@ public class JoinHelper { ThreadPool.Names.GENERIC, ValidateJoinRequest::new, (request, channel, task) -> { final ClusterState localState = currentStateSupplier.get(); - if (localState.metaData().clusterUUIDCommitted() && - localState.metaData().clusterUUID().equals(request.getState().metaData().clusterUUID()) == false) { + if (localState.metadata().clusterUUIDCommitted() && + localState.metadata().clusterUUID().equals(request.getState().metadata().clusterUUID()) == false) { throw new CoordinationStateRejectedException("mixed-version cluster join validation on cluster state" + - " with a different cluster uuid " + request.getState().metaData().clusterUUID() + - " than local cluster uuid " + localState.metaData().clusterUUID() + " with a different cluster uuid " + request.getState().metadata().clusterUUID() + + " than local cluster uuid " + localState.metadata().clusterUUID() + ", rejecting"); } joinValidators.forEach(action -> action.accept(transportService.getLocalNode(), request.getState())); diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/JoinTaskExecutor.java b/server/src/main/java/org/elasticsearch/cluster/coordination/JoinTaskExecutor.java index d5818dd74ac..c24c0fa5a41 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/JoinTaskExecutor.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/JoinTaskExecutor.java @@ -25,8 +25,8 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateTaskExecutor; import org.elasticsearch.cluster.NotMasterException; import org.elasticsearch.cluster.block.ClusterBlocks; -import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.RerouteService; @@ -34,7 +34,7 @@ import org.elasticsearch.cluster.routing.allocation.AllocationService; import org.elasticsearch.common.Priority; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.zen.ElectMasterService; -import org.elasticsearch.persistent.PersistentTasksCustomMetaData; +import org.elasticsearch.persistent.PersistentTasksCustomMetadata; import java.util.ArrayList; import java.util.Collection; @@ -143,7 +143,7 @@ public class JoinTaskExecutor implements ClusterStateTaskExecutor> validators = new ArrayList<>(); validators.add((node, state) -> { ensureNodesCompatibility(node.getVersion(), state.getNodes()); - ensureIndexCompatibility(node.getVersion(), state.getMetaData()); + ensureIndexCompatibility(node.getVersion(), state.getMetadata()); }); validators.addAll(onJoinValidators); return Collections.unmodifiableCollection(validators); diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/NodeRemovalClusterStateTaskExecutor.java b/server/src/main/java/org/elasticsearch/cluster/coordination/NodeRemovalClusterStateTaskExecutor.java index f0f7c6e5db7..88f0ecb93bc 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/NodeRemovalClusterStateTaskExecutor.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/NodeRemovalClusterStateTaskExecutor.java @@ -26,7 +26,7 @@ import org.elasticsearch.cluster.ClusterStateTaskListener; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.allocation.AllocationService; -import org.elasticsearch.persistent.PersistentTasksCustomMetaData; +import org.elasticsearch.persistent.PersistentTasksCustomMetadata; import java.util.List; @@ -92,7 +92,7 @@ public class NodeRemovalClusterStateTaskExecutor implements ClusterStateTaskExec protected ClusterTasksResult getTaskClusterTasksResult(ClusterState currentState, List tasks, ClusterState remainingNodesClusterState) { - ClusterState ptasksDisassociatedState = PersistentTasksCustomMetaData.disassociateDeadNodes(remainingNodesClusterState); + ClusterState ptasksDisassociatedState = PersistentTasksCustomMetadata.disassociateDeadNodes(remainingNodesClusterState); final ClusterTasksResult.Builder resultBuilder = ClusterTasksResult.builder().successes(tasks); return resultBuilder.build(allocationService.disassociateDeadNodes(ptasksDisassociatedState, true, describeTasks(tasks))); } diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/PreVoteCollector.java b/server/src/main/java/org/elasticsearch/cluster/coordination/PreVoteCollector.java index 780f704c34e..63eb4fd0f5a 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/PreVoteCollector.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/PreVoteCollector.java @@ -184,7 +184,7 @@ public class PreVoteCollector { if (response.getLastAcceptedTerm() > clusterState.term() || (response.getLastAcceptedTerm() == clusterState.term() - && response.getLastAcceptedVersion() > clusterState.getVersionOrMetaDataVersion())) { + && response.getLastAcceptedVersion() > clusterState.getVersionOrMetadataVersion())) { logger.debug("{} ignoring {} from {} as it is fresher", this, response, sender); return; } diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/Reconfigurator.java b/server/src/main/java/org/elasticsearch/cluster/coordination/Reconfigurator.java index fd9bab3af11..072723a1f4a 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/Reconfigurator.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/Reconfigurator.java @@ -21,7 +21,7 @@ package org.elasticsearch.cluster.coordination; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfiguration; +import org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfiguration; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Setting; diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/RemoveCustomsCommand.java b/server/src/main/java/org/elasticsearch/cluster/coordination/RemoveCustomsCommand.java index 35fcd8b517d..0cb230d2435 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/RemoveCustomsCommand.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/RemoveCustomsCommand.java @@ -25,7 +25,7 @@ import org.elasticsearch.cli.ExitCodes; import org.elasticsearch.cli.Terminal; import org.elasticsearch.cli.UserException; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.regex.Regex; import org.elasticsearch.env.Environment; @@ -67,14 +67,14 @@ public class RemoveCustomsCommand extends ElasticsearchNodeCommand { terminal.println(Terminal.Verbosity.VERBOSE, "Loading cluster state"); final Tuple termAndClusterState = loadTermAndClusterState(persistedClusterStateService, env); final ClusterState oldClusterState = termAndClusterState.v2(); - terminal.println(Terminal.Verbosity.VERBOSE, "custom metadata names: " + oldClusterState.metaData().customs().keys()); - final MetaData.Builder metaDataBuilder = MetaData.builder(oldClusterState.metaData()); + terminal.println(Terminal.Verbosity.VERBOSE, "custom metadata names: " + oldClusterState.metadata().customs().keys()); + final Metadata.Builder metadataBuilder = Metadata.builder(oldClusterState.metadata()); for (String customToRemove : customsToRemove) { boolean matched = false; - for (ObjectCursor customKeyCur : oldClusterState.metaData().customs().keys()) { + for (ObjectCursor customKeyCur : oldClusterState.metadata().customs().keys()) { final String customKey = customKeyCur.value; if (Regex.simpleMatch(customToRemove, customKey)) { - metaDataBuilder.removeCustom(customKey); + metadataBuilder.removeCustom(customKey); if (matched == false) { terminal.println("The following customs will be removed:"); } @@ -87,7 +87,7 @@ public class RemoveCustomsCommand extends ElasticsearchNodeCommand { "No custom metadata matching [" + customToRemove + "] were found on this node"); } } - final ClusterState newClusterState = ClusterState.builder(oldClusterState).metaData(metaDataBuilder.build()).build(); + final ClusterState newClusterState = ClusterState.builder(oldClusterState).metadata(metadataBuilder.build()).build(); terminal.println(Terminal.Verbosity.VERBOSE, "[old cluster state = " + oldClusterState + ", new cluster state = " + newClusterState + "]"); diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/RemoveSettingsCommand.java b/server/src/main/java/org/elasticsearch/cluster/coordination/RemoveSettingsCommand.java index 66989fcdff3..12912091a08 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/RemoveSettingsCommand.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/RemoveSettingsCommand.java @@ -24,7 +24,7 @@ import org.elasticsearch.cli.ExitCodes; import org.elasticsearch.cli.Terminal; import org.elasticsearch.cli.UserException; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.regex.Regex; import org.elasticsearch.common.settings.Settings; @@ -67,7 +67,7 @@ public class RemoveSettingsCommand extends ElasticsearchNodeCommand { terminal.println(Terminal.Verbosity.VERBOSE, "Loading cluster state"); final Tuple termAndClusterState = loadTermAndClusterState(persistedClusterStateService, env); final ClusterState oldClusterState = termAndClusterState.v2(); - final Settings oldPersistentSettings = oldClusterState.metaData().persistentSettings(); + final Settings oldPersistentSettings = oldClusterState.metadata().persistentSettings(); terminal.println(Terminal.Verbosity.VERBOSE, "persistent settings: " + oldPersistentSettings); final Settings.Builder newPersistentSettingsBuilder = Settings.builder().put(oldPersistentSettings); for (String settingToRemove : settingsToRemove) { @@ -88,7 +88,7 @@ public class RemoveSettingsCommand extends ElasticsearchNodeCommand { } } final ClusterState newClusterState = ClusterState.builder(oldClusterState) - .metaData(MetaData.builder(oldClusterState.metaData()).persistentSettings(newPersistentSettingsBuilder.build()).build()) + .metadata(Metadata.builder(oldClusterState.metadata()).persistentSettings(newPersistentSettingsBuilder.build()).build()) .build(); terminal.println(Terminal.Verbosity.VERBOSE, "[old cluster state = " + oldClusterState + ", new cluster state = " + newClusterState + "]"); diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/UnsafeBootstrapMasterCommand.java b/server/src/main/java/org/elasticsearch/cluster/coordination/UnsafeBootstrapMasterCommand.java index f6bee26f7f7..eaa3f74a876 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/UnsafeBootstrapMasterCommand.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/UnsafeBootstrapMasterCommand.java @@ -22,7 +22,7 @@ import joptsimple.OptionSet; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.cli.Terminal; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.settings.Setting; @@ -84,39 +84,39 @@ public class UnsafeBootstrapMasterCommand extends ElasticsearchNodeCommand { final Tuple state = loadTermAndClusterState(persistedClusterStateService, env); final ClusterState oldClusterState = state.v2(); - final MetaData metaData = oldClusterState.metaData(); + final Metadata metadata = oldClusterState.metadata(); - final CoordinationMetaData coordinationMetaData = metaData.coordinationMetaData(); - if (coordinationMetaData == null || - coordinationMetaData.getLastCommittedConfiguration() == null || - coordinationMetaData.getLastCommittedConfiguration().isEmpty()) { + final CoordinationMetadata coordinationMetadata = metadata.coordinationMetadata(); + if (coordinationMetadata == null || + coordinationMetadata.getLastCommittedConfiguration() == null || + coordinationMetadata.getLastCommittedConfiguration().isEmpty()) { throw new ElasticsearchException(EMPTY_LAST_COMMITTED_VOTING_CONFIG_MSG); } - terminal.println(String.format(Locale.ROOT, CLUSTER_STATE_TERM_VERSION_MSG_FORMAT, coordinationMetaData.term(), - metaData.version())); + terminal.println(String.format(Locale.ROOT, CLUSTER_STATE_TERM_VERSION_MSG_FORMAT, coordinationMetadata.term(), + metadata.version())); - CoordinationMetaData newCoordinationMetaData = CoordinationMetaData.builder(coordinationMetaData) + CoordinationMetadata newCoordinationMetadata = CoordinationMetadata.builder(coordinationMetadata) .clearVotingConfigExclusions() - .lastAcceptedConfiguration(new CoordinationMetaData.VotingConfiguration( + .lastAcceptedConfiguration(new CoordinationMetadata.VotingConfiguration( Collections.singleton(persistedClusterStateService.getNodeId()))) - .lastCommittedConfiguration(new CoordinationMetaData.VotingConfiguration( + .lastCommittedConfiguration(new CoordinationMetadata.VotingConfiguration( Collections.singleton(persistedClusterStateService.getNodeId()))) .build(); Settings persistentSettings = Settings.builder() - .put(metaData.persistentSettings()) + .put(metadata.persistentSettings()) .put(UNSAFE_BOOTSTRAP.getKey(), true) .build(); - MetaData newMetaData = MetaData.builder(metaData) - .clusterUUID(MetaData.UNKNOWN_CLUSTER_UUID) + Metadata newMetadata = Metadata.builder(metadata) + .clusterUUID(Metadata.UNKNOWN_CLUSTER_UUID) .generateClusterUuidIfNeeded() .clusterUUIDCommitted(true) .persistentSettings(persistentSettings) - .coordinationMetaData(newCoordinationMetaData) + .coordinationMetadata(newCoordinationMetadata) .build(); final ClusterState newClusterState = ClusterState.builder(oldClusterState) - .metaData(newMetaData).build(); + .metadata(newMetadata).build(); terminal.println(Terminal.Verbosity.VERBOSE, "[old cluster state = " + oldClusterState + ", new cluster state = " + newClusterState + "]"); diff --git a/server/src/main/java/org/elasticsearch/cluster/health/ClusterIndexHealth.java b/server/src/main/java/org/elasticsearch/cluster/health/ClusterIndexHealth.java index c1a52f2ffc5..fd6ed089a83 100644 --- a/server/src/main/java/org/elasticsearch/cluster/health/ClusterIndexHealth.java +++ b/server/src/main/java/org/elasticsearch/cluster/health/ClusterIndexHealth.java @@ -19,7 +19,7 @@ package org.elasticsearch.cluster.health; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.routing.IndexRoutingTable; import org.elasticsearch.cluster.routing.IndexShardRoutingTable; import org.elasticsearch.common.ParseField; @@ -110,10 +110,10 @@ public final class ClusterIndexHealth implements Iterable, W private final ClusterHealthStatus status; private final Map shards; - public ClusterIndexHealth(final IndexMetaData indexMetaData, final IndexRoutingTable indexRoutingTable) { - this.index = indexMetaData.getIndex().getName(); - this.numberOfShards = indexMetaData.getNumberOfShards(); - this.numberOfReplicas = indexMetaData.getNumberOfReplicas(); + public ClusterIndexHealth(final IndexMetadata indexMetadata, final IndexRoutingTable indexRoutingTable) { + this.index = indexMetadata.getIndex().getName(); + this.numberOfShards = indexMetadata.getNumberOfShards(); + this.numberOfReplicas = indexMetadata.getNumberOfReplicas(); shards = new HashMap<>(); for (IndexShardRoutingTable shardRoutingTable : indexRoutingTable) { diff --git a/server/src/main/java/org/elasticsearch/cluster/health/ClusterStateHealth.java b/server/src/main/java/org/elasticsearch/cluster/health/ClusterStateHealth.java index ad1561e4f0e..2a329e4c5c0 100644 --- a/server/src/main/java/org/elasticsearch/cluster/health/ClusterStateHealth.java +++ b/server/src/main/java/org/elasticsearch/cluster/health/ClusterStateHealth.java @@ -19,7 +19,7 @@ package org.elasticsearch.cluster.health; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.routing.IndexRoutingTable; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.common.io.stream.StreamInput; @@ -55,7 +55,7 @@ public final class ClusterStateHealth implements Iterable, W * @param clusterState The current cluster state. Must not be null. */ public ClusterStateHealth(final ClusterState clusterState) { - this(clusterState, clusterState.metaData().getConcreteAllIndices()); + this(clusterState, clusterState.metadata().getConcreteAllIndices()); } /** @@ -70,12 +70,12 @@ public final class ClusterStateHealth implements Iterable, W indices = new HashMap<>(); for (String index : concreteIndices) { IndexRoutingTable indexRoutingTable = clusterState.routingTable().index(index); - IndexMetaData indexMetaData = clusterState.metaData().index(index); + IndexMetadata indexMetadata = clusterState.metadata().index(index); if (indexRoutingTable == null) { continue; } - ClusterIndexHealth indexHealth = new ClusterIndexHealth(indexMetaData, indexRoutingTable); + ClusterIndexHealth indexHealth = new ClusterIndexHealth(indexMetadata, indexRoutingTable); indices.put(indexHealth.getIndex(), indexHealth); } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/AliasAction.java b/server/src/main/java/org/elasticsearch/cluster/metadata/AliasAction.java index 2067589f74d..c4129357f2d 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/AliasAction.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/AliasAction.java @@ -45,7 +45,7 @@ public abstract class AliasAction { /** * Should this action remove the index? Actions that return true from this will never execute - * {@link #apply(NewAliasValidator, MetaData.Builder, IndexMetaData)}. + * {@link #apply(NewAliasValidator, Metadata.Builder, IndexMetadata)}. */ abstract boolean removeIndex(); @@ -57,7 +57,7 @@ public abstract class AliasAction { * @param index metadata for the index being changed * @return did this action make any changes? */ - abstract boolean apply(NewAliasValidator aliasValidator, MetaData.Builder metadata, IndexMetaData index); + abstract boolean apply(NewAliasValidator aliasValidator, Metadata.Builder metadata, IndexMetadata index); /** * Validate a new alias. @@ -126,20 +126,20 @@ public abstract class AliasAction { } @Override - boolean apply(NewAliasValidator aliasValidator, MetaData.Builder metadata, IndexMetaData index) { + boolean apply(NewAliasValidator aliasValidator, Metadata.Builder metadata, IndexMetadata index) { aliasValidator.validate(alias, indexRouting, filter, writeIndex); - AliasMetaData newAliasMd = AliasMetaData.newAliasMetaDataBuilder(alias).filter(filter).indexRouting(indexRouting) + AliasMetadata newAliasMd = AliasMetadata.newAliasMetadataBuilder(alias).filter(filter).indexRouting(indexRouting) .searchRouting(searchRouting).writeIndex(writeIndex).isHidden(isHidden).build(); // Check if this alias already exists - AliasMetaData currentAliasMd = index.getAliases().get(alias); + AliasMetadata currentAliasMd = index.getAliases().get(alias); if (currentAliasMd != null && currentAliasMd.equals(newAliasMd)) { // It already exists, ignore it return false; } - metadata.put(IndexMetaData.builder(index).putAlias(newAliasMd)); + metadata.put(IndexMetadata.builder(index).putAlias(newAliasMd)); return true; } } @@ -174,11 +174,11 @@ public abstract class AliasAction { } @Override - boolean apply(NewAliasValidator aliasValidator, MetaData.Builder metadata, IndexMetaData index) { + boolean apply(NewAliasValidator aliasValidator, Metadata.Builder metadata, IndexMetadata index) { if (false == index.getAliases().containsKey(alias)) { return false; } - metadata.put(IndexMetaData.builder(index).removeAlias(alias)); + metadata.put(IndexMetadata.builder(index).removeAlias(alias)); return true; } } @@ -198,7 +198,7 @@ public abstract class AliasAction { } @Override - boolean apply(NewAliasValidator aliasValidator, MetaData.Builder metadata, IndexMetaData index) { + boolean apply(NewAliasValidator aliasValidator, Metadata.Builder metadata, IndexMetadata index) { throw new UnsupportedOperationException(); } } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/AliasMetaData.java b/server/src/main/java/org/elasticsearch/cluster/metadata/AliasMetadata.java similarity index 86% rename from server/src/main/java/org/elasticsearch/cluster/metadata/AliasMetaData.java rename to server/src/main/java/org/elasticsearch/cluster/metadata/AliasMetadata.java index cdb8e4ec638..b116d96f9b9 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/AliasMetaData.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/AliasMetadata.java @@ -46,7 +46,7 @@ import java.util.Set; import static java.util.Collections.emptySet; -public class AliasMetaData extends AbstractDiffable implements ToXContentFragment { +public class AliasMetadata extends AbstractDiffable implements ToXContentFragment { private final String alias; @@ -64,7 +64,7 @@ public class AliasMetaData extends AbstractDiffable implements To @Nullable private final Boolean isHidden; - private AliasMetaData(String alias, CompressedXContent filter, String indexRouting, String searchRouting, Boolean writeIndex, + private AliasMetadata(String alias, CompressedXContent filter, String indexRouting, String searchRouting, Boolean writeIndex, @Nullable Boolean isHidden) { this.alias = alias; this.filter = filter; @@ -79,9 +79,9 @@ public class AliasMetaData extends AbstractDiffable implements To this.isHidden = isHidden; } - private AliasMetaData(AliasMetaData aliasMetaData, String alias) { - this(alias, aliasMetaData.filter(), aliasMetaData.indexRouting(), aliasMetaData.searchRouting(), aliasMetaData.writeIndex(), - aliasMetaData.isHidden); + private AliasMetadata(AliasMetadata aliasMetadata, String alias) { + this(alias, aliasMetadata.filter(), aliasMetadata.indexRouting(), aliasMetadata.searchRouting(), aliasMetadata.writeIndex(), + aliasMetadata.isHidden); } public String alias() { @@ -137,15 +137,15 @@ public class AliasMetaData extends AbstractDiffable implements To return new Builder(alias); } - public static Builder newAliasMetaDataBuilder(String alias) { + public static Builder newAliasMetadataBuilder(String alias) { return new Builder(alias); } /** - * Creates a new AliasMetaData instance with same content as the given one, but with a different alias name + * Creates a new AliasMetadata instance with same content as the given one, but with a different alias name */ - public static AliasMetaData newAliasMetaData(AliasMetaData aliasMetaData, String newAlias) { - return new AliasMetaData(aliasMetaData, newAlias); + public static AliasMetadata newAliasMetadata(AliasMetadata aliasMetadata, String newAlias) { + return new AliasMetadata(aliasMetadata, newAlias); } @Override @@ -153,7 +153,7 @@ public class AliasMetaData extends AbstractDiffable implements To if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - final AliasMetaData that = (AliasMetaData) o; + final AliasMetadata that = (AliasMetadata) o; if (Objects.equals(alias, that.alias) == false) return false; if (Objects.equals(filter, that.filter) == false) return false; @@ -206,7 +206,7 @@ public class AliasMetaData extends AbstractDiffable implements To } } - public AliasMetaData(StreamInput in) throws IOException { + public AliasMetadata(StreamInput in) throws IOException { alias = in.readString(); if (in.readBoolean()) { filter = CompressedXContent.readCompressedString(in); @@ -238,8 +238,8 @@ public class AliasMetaData extends AbstractDiffable implements To } } - public static Diff readDiffFrom(StreamInput in) throws IOException { - return readDiffFrom(AliasMetaData::new, in); + public static Diff readDiffFrom(StreamInput in) throws IOException { + return readDiffFrom(AliasMetadata::new, in); } @Override @@ -249,7 +249,7 @@ public class AliasMetaData extends AbstractDiffable implements To @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { - AliasMetaData.Builder.toXContent(this, builder, params); + AliasMetadata.Builder.toXContent(this, builder, params); return builder; } @@ -330,41 +330,41 @@ public class AliasMetaData extends AbstractDiffable implements To return this; } - public AliasMetaData build() { - return new AliasMetaData(alias, filter, indexRouting, searchRouting, writeIndex, isHidden); + public AliasMetadata build() { + return new AliasMetadata(alias, filter, indexRouting, searchRouting, writeIndex, isHidden); } - public static void toXContent(AliasMetaData aliasMetaData, XContentBuilder builder, ToXContent.Params params) throws IOException { - builder.startObject(aliasMetaData.alias()); + public static void toXContent(AliasMetadata aliasMetadata, XContentBuilder builder, ToXContent.Params params) throws IOException { + builder.startObject(aliasMetadata.alias()); boolean binary = params.paramAsBoolean("binary", false); - if (aliasMetaData.filter() != null) { + if (aliasMetadata.filter() != null) { if (binary) { - builder.field("filter", aliasMetaData.filter.compressed()); + builder.field("filter", aliasMetadata.filter.compressed()); } else { - builder.field("filter", XContentHelper.convertToMap(new BytesArray(aliasMetaData.filter().uncompressed()), true).v2()); + builder.field("filter", XContentHelper.convertToMap(new BytesArray(aliasMetadata.filter().uncompressed()), true).v2()); } } - if (aliasMetaData.indexRouting() != null) { - builder.field("index_routing", aliasMetaData.indexRouting()); + if (aliasMetadata.indexRouting() != null) { + builder.field("index_routing", aliasMetadata.indexRouting()); } - if (aliasMetaData.searchRouting() != null) { - builder.field("search_routing", aliasMetaData.searchRouting()); + if (aliasMetadata.searchRouting() != null) { + builder.field("search_routing", aliasMetadata.searchRouting()); } - if (aliasMetaData.writeIndex() != null) { - builder.field("is_write_index", aliasMetaData.writeIndex()); + if (aliasMetadata.writeIndex() != null) { + builder.field("is_write_index", aliasMetadata.writeIndex()); } - if (aliasMetaData.isHidden != null) { - builder.field("is_hidden", aliasMetaData.isHidden()); + if (aliasMetadata.isHidden != null) { + builder.field("is_hidden", aliasMetadata.isHidden()); } builder.endObject(); } - public static AliasMetaData fromXContent(XContentParser parser) throws IOException { + public static AliasMetadata fromXContent(XContentParser parser) throws IOException { Builder builder = new Builder(parser.currentName()); String currentFieldName = null; diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/AliasValidator.java b/server/src/main/java/org/elasticsearch/cluster/metadata/AliasValidator.java index ebcffacf0a6..2bb0a5664fd 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/AliasValidator.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/AliasValidator.java @@ -47,17 +47,17 @@ public class AliasValidator { * it's valid before it gets added to the index metadata. Doesn't validate the alias filter. * @throws IllegalArgumentException if the alias is not valid */ - public void validateAlias(Alias alias, String index, MetaData metaData) { - validateAlias(alias.name(), index, alias.indexRouting(), metaData::index); + public void validateAlias(Alias alias, String index, Metadata metadata) { + validateAlias(alias.name(), index, alias.indexRouting(), metadata::index); } /** - * Allows to validate an {@link org.elasticsearch.cluster.metadata.AliasMetaData} and make sure + * Allows to validate an {@link org.elasticsearch.cluster.metadata.AliasMetadata} and make sure * it's valid before it gets added to the index metadata. Doesn't validate the alias filter. * @throws IllegalArgumentException if the alias is not valid */ - public void validateAliasMetaData(AliasMetaData aliasMetaData, String index, MetaData metaData) { - validateAlias(aliasMetaData.alias(), index, aliasMetaData.indexRouting(), metaData::index); + public void validateAliasMetadata(AliasMetadata aliasMetadata, String index, Metadata metadata) { + validateAlias(aliasMetadata.alias(), index, aliasMetadata.indexRouting(), metadata::index); } /** @@ -81,14 +81,14 @@ public class AliasValidator { /** * Validate a proposed alias. */ - public void validateAlias(String alias, String index, @Nullable String indexRouting, Function indexLookup) { + public void validateAlias(String alias, String index, @Nullable String indexRouting, Function indexLookup) { validateAliasStandalone(alias, indexRouting); if (!Strings.hasText(index)) { throw new IllegalArgumentException("index name is required"); } - IndexMetaData indexNamedSameAsAlias = indexLookup.apply(alias); + IndexMetadata indexNamedSameAsAlias = indexLookup.apply(alias); if (indexNamedSameAsAlias != null) { throw new InvalidAliasNameException(indexNamedSameAsAlias.getIndex(), alias, "an index exists with the same name as the alias"); } @@ -98,7 +98,7 @@ public class AliasValidator { if (!Strings.hasText(alias)) { throw new IllegalArgumentException("alias name is required"); } - MetaDataCreateIndexService.validateIndexOrAliasName(alias, InvalidAliasNameException::new); + MetadataCreateIndexService.validateIndexOrAliasName(alias, InvalidAliasNameException::new); if (indexRouting != null && indexRouting.indexOf(',') != -1) { throw new IllegalArgumentException("alias [" + alias + "] has several index routing values associated with it"); } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/AutoExpandReplicas.java b/server/src/main/java/org/elasticsearch/cluster/metadata/AutoExpandReplicas.java index ffd1c2a8263..4f29a567a72 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/AutoExpandReplicas.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/AutoExpandReplicas.java @@ -33,7 +33,7 @@ import java.util.List; import java.util.Map; import java.util.OptionalInt; -import static org.elasticsearch.cluster.metadata.MetaDataIndexStateService.isIndexVerifiedBeforeClosed; +import static org.elasticsearch.cluster.metadata.MetadataIndexStateService.isIndexVerifiedBeforeClosed; /** * This class acts as a functional wrapper around the {@code index.auto_expand_replicas} setting. @@ -46,7 +46,7 @@ public final class AutoExpandReplicas { private static final AutoExpandReplicas FALSE_INSTANCE = new AutoExpandReplicas(0, 0, false); - public static final Setting SETTING = new Setting<>(IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS, "false", + public static final Setting SETTING = new Setting<>(IndexMetadata.SETTING_AUTO_EXPAND_REPLICAS, "false", AutoExpandReplicas::parse, Property.Dynamic, Property.IndexScope); private static AutoExpandReplicas parse(String value) { @@ -57,14 +57,14 @@ public final class AutoExpandReplicas { } final int dash = value.indexOf('-'); if (-1 == dash) { - throw new IllegalArgumentException("failed to parse [" + IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS + + throw new IllegalArgumentException("failed to parse [" + IndexMetadata.SETTING_AUTO_EXPAND_REPLICAS + "] from value: [" + value + "] at index " + dash); } final String sMin = value.substring(0, dash); try { min = Integer.parseInt(sMin); } catch (NumberFormatException e) { - throw new IllegalArgumentException("failed to parse [" + IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS + + throw new IllegalArgumentException("failed to parse [" + IndexMetadata.SETTING_AUTO_EXPAND_REPLICAS + "] from value: [" + value + "] at index " + dash, e); } String sMax = value.substring(dash + 1); @@ -74,7 +74,7 @@ public final class AutoExpandReplicas { try { max = Integer.parseInt(sMax); } catch (NumberFormatException e) { - throw new IllegalArgumentException("failed to parse [" + IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS + + throw new IllegalArgumentException("failed to parse [" + IndexMetadata.SETTING_AUTO_EXPAND_REPLICAS + "] from value: [" + value + "] at index " + dash, e); } } @@ -87,7 +87,7 @@ public final class AutoExpandReplicas { private AutoExpandReplicas(int minReplicas, int maxReplicas, boolean enabled) { if (minReplicas > maxReplicas) { - throw new IllegalArgumentException("[" + IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS + + throw new IllegalArgumentException("[" + IndexMetadata.SETTING_AUTO_EXPAND_REPLICAS + "] minReplicas must be =< maxReplicas but wasn't " + minReplicas + " > " + maxReplicas); } this.minReplicas = minReplicas; @@ -103,13 +103,13 @@ public final class AutoExpandReplicas { return Math.min(maxReplicas, numDataNodes-1); } - private OptionalInt getDesiredNumberOfReplicas(IndexMetaData indexMetaData, RoutingAllocation allocation) { + private OptionalInt getDesiredNumberOfReplicas(IndexMetadata indexMetadata, RoutingAllocation allocation) { if (enabled) { int numMatchingDataNodes = 0; // Only start using new logic once all nodes are migrated to 7.6.0, avoiding disruption during an upgrade if (allocation.nodes().getMinNodeVersion().onOrAfter(Version.V_7_6_0)) { for (ObjectCursor cursor : allocation.nodes().getDataNodes().values()) { - Decision decision = allocation.deciders().shouldAutoExpandToNode(indexMetaData, cursor.value, allocation); + Decision decision = allocation.deciders().shouldAutoExpandToNode(indexMetadata, cursor.value, allocation); if (decision.type() != Decision.Type.NO) { numMatchingDataNodes ++; } @@ -145,15 +145,15 @@ public final class AutoExpandReplicas { * The map has the desired number of replicas as key and the indices to update as value, as this allows the result * of this method to be directly applied to RoutingTable.Builder#updateNumberOfReplicas. */ - public static Map> getAutoExpandReplicaChanges(MetaData metaData, RoutingAllocation allocation) { + public static Map> getAutoExpandReplicaChanges(Metadata metadata, RoutingAllocation allocation) { Map> nrReplicasChanged = new HashMap<>(); - for (final IndexMetaData indexMetaData : metaData) { - if (indexMetaData.getState() == IndexMetaData.State.OPEN || isIndexVerifiedBeforeClosed(indexMetaData)) { - AutoExpandReplicas autoExpandReplicas = SETTING.get(indexMetaData.getSettings()); - autoExpandReplicas.getDesiredNumberOfReplicas(indexMetaData, allocation).ifPresent(numberOfReplicas -> { - if (numberOfReplicas != indexMetaData.getNumberOfReplicas()) { - nrReplicasChanged.computeIfAbsent(numberOfReplicas, ArrayList::new).add(indexMetaData.getIndex().getName()); + for (final IndexMetadata indexMetadata : metadata) { + if (indexMetadata.getState() == IndexMetadata.State.OPEN || isIndexVerifiedBeforeClosed(indexMetadata)) { + AutoExpandReplicas autoExpandReplicas = SETTING.get(indexMetadata.getSettings()); + autoExpandReplicas.getDesiredNumberOfReplicas(indexMetadata, allocation).ifPresent(numberOfReplicas -> { + if (numberOfReplicas != indexMetadata.getNumberOfReplicas()) { + nrReplicasChanged.computeIfAbsent(numberOfReplicas, ArrayList::new).add(indexMetadata.getIndex().getName()); } }); } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/ComponentTemplateMetadata.java b/server/src/main/java/org/elasticsearch/cluster/metadata/ComponentTemplateMetadata.java index 1b1e6b346ef..e1b2cfd415b 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/ComponentTemplateMetadata.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/ComponentTemplateMetadata.java @@ -38,10 +38,10 @@ import java.util.Map; import java.util.Objects; /** - * {@link ComponentTemplateMetadata} is a custom {@link MetaData} implementation for storing a map + * {@link ComponentTemplateMetadata} is a custom {@link Metadata} implementation for storing a map * of component templates and their names. */ -public class ComponentTemplateMetadata implements MetaData.Custom { +public class ComponentTemplateMetadata implements Metadata.Custom { public static final String TYPE = "component_template"; private static final ParseField COMPONENT_TEMPLATE = new ParseField("component_template"); @SuppressWarnings("unchecked") @@ -73,17 +73,17 @@ public class ComponentTemplateMetadata implements MetaData.Custom { } @Override - public Diff diff(MetaData.Custom before) { + public Diff diff(Metadata.Custom before) { return new ComponentTemplateMetadataDiff((ComponentTemplateMetadata) before, this); } - public static NamedDiff readDiffFrom(StreamInput in) throws IOException { + public static NamedDiff readDiffFrom(StreamInput in) throws IOException { return new ComponentTemplateMetadataDiff(in); } @Override - public EnumSet context() { - return MetaData.ALL_CONTEXTS; + public EnumSet context() { + return Metadata.ALL_CONTEXTS; } @Override @@ -137,7 +137,7 @@ public class ComponentTemplateMetadata implements MetaData.Custom { return Strings.toString(this); } - static class ComponentTemplateMetadataDiff implements NamedDiff { + static class ComponentTemplateMetadataDiff implements NamedDiff { final Diff> componentTemplateDiff; @@ -152,7 +152,7 @@ public class ComponentTemplateMetadata implements MetaData.Custom { } @Override - public MetaData.Custom apply(MetaData.Custom part) { + public Metadata.Custom apply(Metadata.Custom part) { return new ComponentTemplateMetadata(componentTemplateDiff.apply(((ComponentTemplateMetadata) part).componentTemplates)); } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/DataStreamMetadata.java b/server/src/main/java/org/elasticsearch/cluster/metadata/DataStreamMetadata.java index 629f3d72e82..54cf4883c9d 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/DataStreamMetadata.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/DataStreamMetadata.java @@ -38,9 +38,9 @@ import java.util.Map; import java.util.Objects; /** - * Custom {@link MetaData} implementation for storing a map of {@link DataStream}s and their names. + * Custom {@link Metadata} implementation for storing a map of {@link DataStream}s and their names. */ -public class DataStreamMetadata implements MetaData.Custom { +public class DataStreamMetadata implements Metadata.Custom { public static final String TYPE = "data_stream"; private static final ParseField DATA_STREAM = new ParseField("data_stream"); @@ -74,17 +74,17 @@ public class DataStreamMetadata implements MetaData.Custom { } @Override - public Diff diff(MetaData.Custom before) { + public Diff diff(Metadata.Custom before) { return new DataStreamMetadata.DataStreamMetadataDiff((DataStreamMetadata) before, this); } - public static NamedDiff readDiffFrom(StreamInput in) throws IOException { + public static NamedDiff readDiffFrom(StreamInput in) throws IOException { return new DataStreamMetadata.DataStreamMetadataDiff(in); } @Override - public EnumSet context() { - return MetaData.ALL_CONTEXTS; + public EnumSet context() { + return Metadata.ALL_CONTEXTS; } @Override @@ -156,7 +156,7 @@ public class DataStreamMetadata implements MetaData.Custom { } } - static class DataStreamMetadataDiff implements NamedDiff { + static class DataStreamMetadataDiff implements NamedDiff { final Diff> dataStreamDiff; @@ -171,7 +171,7 @@ public class DataStreamMetadata implements MetaData.Custom { } @Override - public MetaData.Custom apply(MetaData.Custom part) { + public Metadata.Custom apply(Metadata.Custom part) { return new DataStreamMetadata(dataStreamDiff.apply(((DataStreamMetadata) part).dataStreams)); } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexAbstraction.java b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexAbstraction.java index a2bde41e137..7448986cec3 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexAbstraction.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexAbstraction.java @@ -31,11 +31,11 @@ import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; -import static org.elasticsearch.cluster.metadata.IndexMetaData.INDEX_HIDDEN_SETTING; +import static org.elasticsearch.cluster.metadata.IndexMetadata.INDEX_HIDDEN_SETTING; /** * An index abstraction is a reference to one or more concrete indices. - * An index abstraction has a unique name and encapsulates all the {@link IndexMetaData} instances it is pointing to. + * An index abstraction has a unique name and encapsulates all the {@link IndexMetadata} instances it is pointing to. * Also depending on type it may refer to a single or many concrete indices and may or may not have a write index. */ public interface IndexAbstraction { @@ -51,9 +51,9 @@ public interface IndexAbstraction { String getName(); /** - * @return All {@link IndexMetaData} of all concrete indices this index abstraction is referring to. + * @return All {@link IndexMetadata} of all concrete indices this index abstraction is referring to. */ - List getIndices(); + List getIndices(); /** * A write index is a dedicated concrete index, that accepts all the new documents that belong to an index abstraction. @@ -65,7 +65,7 @@ public interface IndexAbstraction { * null if this index abstraction doesn't have a write index. */ @Nullable - IndexMetaData getWriteIndex(); + IndexMetadata getWriteIndex(); /** * @return whether this index abstraction is hidden or not @@ -102,14 +102,14 @@ public interface IndexAbstraction { } /** - * Represents an concrete index and encapsulates its {@link IndexMetaData} + * Represents an concrete index and encapsulates its {@link IndexMetadata} */ class Index implements IndexAbstraction { - private final IndexMetaData concreteIndex; + private final IndexMetadata concreteIndex; - public Index(IndexMetaData indexMetaData) { - this.concreteIndex = indexMetaData; + public Index(IndexMetadata indexMetadata) { + this.concreteIndex = indexMetadata; } @Override @@ -123,12 +123,12 @@ public interface IndexAbstraction { } @Override - public List getIndices() { + public List getIndices() { return Collections.singletonList(concreteIndex); } @Override - public IndexMetaData getWriteIndex() { + public IndexMetadata getWriteIndex() { return concreteIndex; } @@ -139,20 +139,20 @@ public interface IndexAbstraction { } /** - * Represents an alias and groups all {@link IndexMetaData} instances sharing the same alias name together. + * Represents an alias and groups all {@link IndexMetadata} instances sharing the same alias name together. */ class Alias implements IndexAbstraction { private final String aliasName; - private final List referenceIndexMetaDatas; - private final SetOnce writeIndex = new SetOnce<>(); + private final List referenceIndexMetadatas; + private final SetOnce writeIndex = new SetOnce<>(); private final boolean isHidden; - public Alias(AliasMetaData aliasMetaData, IndexMetaData indexMetaData) { - this.aliasName = aliasMetaData.getAlias(); - this.referenceIndexMetaDatas = new ArrayList<>(); - this.referenceIndexMetaDatas.add(indexMetaData); - this.isHidden = aliasMetaData.isHidden() == null ? false : aliasMetaData.isHidden(); + public Alias(AliasMetadata aliasMetadata, IndexMetadata indexMetadata) { + this.aliasName = aliasMetadata.getAlias(); + this.referenceIndexMetadatas = new ArrayList<>(); + this.referenceIndexMetadatas.add(indexMetadata); + this.isHidden = aliasMetadata.isHidden() == null ? false : aliasMetadata.isHidden(); } @Override @@ -165,13 +165,13 @@ public interface IndexAbstraction { } @Override - public List getIndices() { - return referenceIndexMetaDatas; + public List getIndices() { + return referenceIndexMetadatas; } @Nullable - public IndexMetaData getWriteIndex() { + public IndexMetadata getWriteIndex() { return writeIndex.get(); } @@ -186,41 +186,41 @@ public interface IndexAbstraction { * (note that although alias can point to the same concrete indices, each alias reference may have its own routing * and filters) */ - public Iterable> getConcreteIndexAndAliasMetaDatas() { - return () -> new Iterator>() { + public Iterable> getConcreteIndexAndAliasMetadatas() { + return () -> new Iterator>() { int index = 0; @Override public boolean hasNext() { - return index < referenceIndexMetaDatas.size(); + return index < referenceIndexMetadatas.size(); } @Override - public Tuple next() { - IndexMetaData indexMetaData = referenceIndexMetaDatas.get(index++); - return new Tuple<>(indexMetaData.getIndex().getName(), indexMetaData.getAliases().get(aliasName)); + public Tuple next() { + IndexMetadata indexMetadata = referenceIndexMetadatas.get(index++); + return new Tuple<>(indexMetadata.getIndex().getName(), indexMetadata.getAliases().get(aliasName)); } }; } - public AliasMetaData getFirstAliasMetaData() { - return referenceIndexMetaDatas.get(0).getAliases().get(aliasName); + public AliasMetadata getFirstAliasMetadata() { + return referenceIndexMetadatas.get(0).getAliases().get(aliasName); } - void addIndex(IndexMetaData indexMetaData) { - this.referenceIndexMetaDatas.add(indexMetaData); + void addIndex(IndexMetadata indexMetadata) { + this.referenceIndexMetadatas.add(indexMetadata); } public void computeAndValidateAliasProperties() { // Validate write indices - List writeIndices = referenceIndexMetaDatas.stream() + List writeIndices = referenceIndexMetadatas.stream() .filter(idxMeta -> Boolean.TRUE.equals(idxMeta.getAliases().get(aliasName).writeIndex())) .collect(Collectors.toList()); - if (writeIndices.isEmpty() && referenceIndexMetaDatas.size() == 1 - && referenceIndexMetaDatas.get(0).getAliases().get(aliasName).writeIndex() == null) { - writeIndices.add(referenceIndexMetaDatas.get(0)); + if (writeIndices.isEmpty() && referenceIndexMetadatas.size() == 1 + && referenceIndexMetadatas.get(0).getAliases().get(aliasName).writeIndex() == null) { + writeIndices.add(referenceIndexMetadatas.get(0)); } if (writeIndices.size() == 1) { @@ -233,7 +233,7 @@ public interface IndexAbstraction { } // Validate hidden status - final Map> groupedByHiddenStatus = referenceIndexMetaDatas.stream() + final Map> groupedByHiddenStatus = referenceIndexMetadatas.stream() .collect(Collectors.groupingBy(idxMeta -> Boolean.TRUE.equals(idxMeta.getAliases().get(aliasName).isHidden()))); if (isNonEmpty(groupedByHiddenStatus.get(true)) && isNonEmpty(groupedByHiddenStatus.get(false))) { List hiddenOn = groupedByHiddenStatus.get(true).stream() @@ -247,7 +247,7 @@ public interface IndexAbstraction { } } - private boolean isNonEmpty(List idxMetas) { + private boolean isNonEmpty(List idxMetas) { return (Objects.isNull(idxMetas) || idxMetas.isEmpty()) == false; } } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexGraveyard.java b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexGraveyard.java index ce93b27d770..69fb551d1b9 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexGraveyard.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexGraveyard.java @@ -55,7 +55,7 @@ import java.util.Objects; * tombstones remain in the cluster state for a fixed period of time, after which * they are purged. */ -public final class IndexGraveyard implements MetaData.Custom { +public final class IndexGraveyard implements Metadata.Custom { /** * Setting for the maximum tombstones allowed in the cluster state; @@ -103,8 +103,8 @@ public final class IndexGraveyard implements MetaData.Custom { } @Override - public EnumSet context() { - return MetaData.API_AND_GATEWAY; + public EnumSet context() { + return Metadata.API_AND_GATEWAY; } @Override @@ -163,11 +163,11 @@ public final class IndexGraveyard implements MetaData.Custom { } @Override - public Diff diff(final MetaData.Custom previous) { + public Diff diff(final Metadata.Custom previous) { return new IndexGraveyardDiff((IndexGraveyard) previous, this); } - public static NamedDiff readDiffFrom(final StreamInput in) throws IOException { + public static NamedDiff readDiffFrom(final StreamInput in) throws IOException { return new IndexGraveyardDiff(in); } @@ -267,7 +267,7 @@ public final class IndexGraveyard implements MetaData.Custom { /** * A class representing a diff of two IndexGraveyard objects. */ - public static final class IndexGraveyardDiff implements NamedDiff { + public static final class IndexGraveyardDiff implements NamedDiff { private final List added; private final int removedCount; @@ -321,7 +321,7 @@ public final class IndexGraveyard implements MetaData.Custom { } @Override - public IndexGraveyard apply(final MetaData.Custom previous) { + public IndexGraveyard apply(final Metadata.Custom previous) { final IndexGraveyard old = (IndexGraveyard) previous; if (removedCount > old.tombstones.size()) { throw new IllegalStateException("IndexGraveyardDiff cannot remove [" + removedCount + "] entries from [" + diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java similarity index 90% rename from server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java rename to server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java index 134936ebfc3..082da02bfbf 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java @@ -33,7 +33,7 @@ import org.elasticsearch.cluster.DiffableUtils; import org.elasticsearch.cluster.block.ClusterBlock; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.node.DiscoveryNodeFilters; -import org.elasticsearch.cluster.routing.allocation.IndexMetaDataUpdater; +import org.elasticsearch.cluster.routing.allocation.IndexMetadataUpdater; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.collect.ImmutableOpenIntMap; @@ -51,7 +51,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.gateway.MetaDataStateFormat; +import org.elasticsearch.gateway.MetadataStateFormat; import org.elasticsearch.index.Index; import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.index.seqno.SequenceNumbers; @@ -74,14 +74,14 @@ import java.util.Map; import java.util.Set; import java.util.function.Function; -import static org.elasticsearch.cluster.metadata.MetaData.CONTEXT_MODE_PARAM; +import static org.elasticsearch.cluster.metadata.Metadata.CONTEXT_MODE_PARAM; import static org.elasticsearch.cluster.node.DiscoveryNodeFilters.IP_VALIDATOR; import static org.elasticsearch.cluster.node.DiscoveryNodeFilters.OpType.AND; import static org.elasticsearch.cluster.node.DiscoveryNodeFilters.OpType.OR; import static org.elasticsearch.common.settings.Settings.readSettingsFromStream; import static org.elasticsearch.common.settings.Settings.writeSettingsToStream; -public class IndexMetaData implements Diffable, ToXContentFragment { +public class IndexMetadata implements Diffable, ToXContentFragment { public static final ClusterBlock INDEX_READ_ONLY_BLOCK = new ClusterBlock(5, "index read-only (api)", false, false, false, @@ -307,11 +307,11 @@ public class IndexMetaData implements Diffable, ToXContentFragmen private final State state; - private final ImmutableOpenMap aliases; + private final ImmutableOpenMap aliases; private final Settings settings; - private final ImmutableOpenMap mappings; + private final ImmutableOpenMap mappings; private final ImmutableOpenMap customData; @@ -330,7 +330,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen private final ActiveShardCount waitForActiveShards; private final ImmutableOpenMap rolloverInfos; - private IndexMetaData( + private IndexMetadata( final Index index, final long version, final long mappingVersion, @@ -341,8 +341,8 @@ public class IndexMetaData implements Diffable, ToXContentFragmen final int numberOfShards, final int numberOfReplicas, final Settings settings, - final ImmutableOpenMap mappings, - final ImmutableOpenMap aliases, + final ImmutableOpenMap mappings, + final ImmutableOpenMap aliases, final ImmutableOpenMap customData, final ImmutableOpenIntMap> inSyncAllocationIds, final DiscoveryNodeFilters requireFilters, @@ -430,7 +430,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen * a primary shard is assigned after a full cluster restart or a replica shard is promoted to a primary. * * Note: since we increment the term every time a shard is assigned, the term for any operational shard (i.e., a shard - * that can be indexed into) is larger than 0. See {@link IndexMetaDataUpdater#applyChanges}. + * that can be indexed into) is larger than 0. See {@link IndexMetadataUpdater#applyChanges}. **/ public long primaryTerm(int shardId) { return this.primaryTerms[shardId]; @@ -492,7 +492,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen return settings; } - public ImmutableOpenMap getAliases() { + public ImmutableOpenMap getAliases() { return this.aliases; } @@ -503,7 +503,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen * @deprecated Use {@link #mapping()} instead now that indices have a single type */ @Deprecated - public ImmutableOpenMap getMappings() { + public ImmutableOpenMap getMappings() { return mappings; } @@ -511,8 +511,8 @@ public class IndexMetaData implements Diffable, ToXContentFragmen * Return the concrete mapping for this index or {@code null} if this index has no mappings at all. */ @Nullable - public MappingMetaData mapping() { - for (ObjectObjectCursor cursor : mappings) { + public MappingMetadata mapping() { + for (ObjectObjectCursor cursor : mappings) { if (cursor.key.equals(MapperService.DEFAULT_MAPPING) == false) { return cursor.value; } @@ -525,7 +525,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen * NOTE: this is always {@code null} for 7.x indices which are disallowed to have a default mapping. */ @Nullable - public MappingMetaData defaultMapping() { + public MappingMetadata defaultMapping() { return mappings.get(MapperService.DEFAULT_MAPPING); } @@ -543,13 +543,13 @@ public class IndexMetaData implements Diffable, ToXContentFragmen * Sometimes, the default mapping exists and an actual mapping is not created yet (introduced), * in this case, we want to return the default mapping in case it has some default mapping definitions. *

- * Note, once the mapping type is introduced, the default mapping is applied on the actual typed MappingMetaData, + * Note, once the mapping type is introduced, the default mapping is applied on the actual typed MappingMetadata, * setting its routing, timestamp, and so on if needed. */ @Nullable - public MappingMetaData mappingOrDefault() { - MappingMetaData mapping = null; - for (ObjectCursor m : mappings.values()) { + public MappingMetadata mappingOrDefault() { + MappingMetadata mapping = null; + for (ObjectCursor m : mappings.values()) { if (mapping == null || mapping.type().equals(MapperService.DEFAULT_MAPPING)) { mapping = m.value; } @@ -608,7 +608,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen return false; } - IndexMetaData that = (IndexMetaData) o; + IndexMetadata that = (IndexMetadata) o; if (version != that.version) { return false; @@ -669,15 +669,15 @@ public class IndexMetaData implements Diffable, ToXContentFragmen @Override - public Diff diff(IndexMetaData previousState) { - return new IndexMetaDataDiff(previousState, this); + public Diff diff(IndexMetadata previousState) { + return new IndexMetadataDiff(previousState, this); } - public static Diff readDiffFrom(StreamInput in) throws IOException { - return new IndexMetaDataDiff(in); + public static Diff readDiffFrom(StreamInput in) throws IOException { + return new IndexMetadataDiff(in); } - public static IndexMetaData fromXContent(XContentParser parser) throws IOException { + public static IndexMetadata fromXContent(XContentParser parser) throws IOException { return Builder.fromXContent(parser); } @@ -687,7 +687,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen return builder; } - private static class IndexMetaDataDiff implements Diff { + private static class IndexMetadataDiff implements Diff { private final String index; private final int routingNumShards; @@ -698,13 +698,13 @@ public class IndexMetaData implements Diffable, ToXContentFragmen private final long[] primaryTerms; private final State state; private final Settings settings; - private final Diff> mappings; - private final Diff> aliases; + private final Diff> mappings; + private final Diff> aliases; private final Diff> customData; private final Diff>> inSyncAllocationIds; private final Diff> rolloverInfos; - IndexMetaDataDiff(IndexMetaData before, IndexMetaData after) { + IndexMetadataDiff(IndexMetadata before, IndexMetadata after) { index = after.index.getName(); version = after.version; mappingVersion = after.mappingVersion; @@ -722,7 +722,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen rolloverInfos = DiffableUtils.diff(before.rolloverInfos, after.rolloverInfos, DiffableUtils.getStringKeySerializer()); } - IndexMetaDataDiff(StreamInput in) throws IOException { + IndexMetadataDiff(StreamInput in) throws IOException { index = in.readString(); routingNumShards = in.readInt(); version = in.readLong(); @@ -744,10 +744,10 @@ public class IndexMetaData implements Diffable, ToXContentFragmen state = State.fromId(in.readByte()); settings = Settings.readSettingsFromStream(in); primaryTerms = in.readVLongArray(); - mappings = DiffableUtils.readImmutableOpenMapDiff(in, DiffableUtils.getStringKeySerializer(), MappingMetaData::new, - MappingMetaData::readDiffFrom); - aliases = DiffableUtils.readImmutableOpenMapDiff(in, DiffableUtils.getStringKeySerializer(), AliasMetaData::new, - AliasMetaData::readDiffFrom); + mappings = DiffableUtils.readImmutableOpenMapDiff(in, DiffableUtils.getStringKeySerializer(), MappingMetadata::new, + MappingMetadata::readDiffFrom); + aliases = DiffableUtils.readImmutableOpenMapDiff(in, DiffableUtils.getStringKeySerializer(), AliasMetadata::new, + AliasMetadata::readDiffFrom); customData = DiffableUtils.readImmutableOpenMapDiff(in, DiffableUtils.getStringKeySerializer(), DiffableStringMap::new, DiffableStringMap::readDiffFrom); inSyncAllocationIds = DiffableUtils.readImmutableOpenIntMapDiff(in, DiffableUtils.getVIntKeySerializer(), @@ -788,7 +788,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen } @Override - public IndexMetaData apply(IndexMetaData part) { + public IndexMetadata apply(IndexMetadata part) { Builder builder = builder(index); builder.version(version); builder.mappingVersion(mappingVersion); @@ -800,14 +800,14 @@ public class IndexMetaData implements Diffable, ToXContentFragmen builder.primaryTerms(primaryTerms); builder.mappings.putAll(mappings.apply(part.mappings)); builder.aliases.putAll(aliases.apply(part.aliases)); - builder.customMetaData.putAll(customData.apply(part.customData)); + builder.customMetadata.putAll(customData.apply(part.customData)); builder.inSyncAllocationIds.putAll(inSyncAllocationIds.apply(part.inSyncAllocationIds)); builder.rolloverInfos.putAll(rolloverInfos.apply(part.rolloverInfos)); return builder.build(); } } - public static IndexMetaData readFrom(StreamInput in) throws IOException { + public static IndexMetadata readFrom(StreamInput in) throws IOException { Builder builder = new Builder(in.readString()); builder.version(in.readLong()); if (in.getVersion().onOrAfter(Version.V_6_5_0)) { @@ -831,12 +831,12 @@ public class IndexMetaData implements Diffable, ToXContentFragmen builder.primaryTerms(in.readVLongArray()); int mappingsSize = in.readVInt(); for (int i = 0; i < mappingsSize; i++) { - MappingMetaData mappingMd = new MappingMetaData(in); + MappingMetadata mappingMd = new MappingMetadata(in); builder.putMapping(mappingMd); } int aliasesSize = in.readVInt(); for (int i = 0; i < aliasesSize; i++) { - AliasMetaData aliasMd = new AliasMetaData(in); + AliasMetadata aliasMd = new AliasMetadata(in); builder.putAlias(aliasMd); } int customSize = in.readVInt(); @@ -885,11 +885,11 @@ public class IndexMetaData implements Diffable, ToXContentFragmen writeSettingsToStream(settings, out); out.writeVLongArray(primaryTerms); out.writeVInt(mappings.size()); - for (ObjectCursor cursor : mappings.values()) { + for (ObjectCursor cursor : mappings.values()) { cursor.value.writeTo(out); } out.writeVInt(aliases.size()); - for (ObjectCursor cursor : aliases.values()) { + for (ObjectCursor cursor : aliases.values()) { cursor.value.writeTo(out); } if (out.getVersion().onOrAfter(Version.V_6_5_0)) { @@ -918,8 +918,8 @@ public class IndexMetaData implements Diffable, ToXContentFragmen return new Builder(index); } - public static Builder builder(IndexMetaData indexMetaData) { - return new Builder(indexMetaData); + public static Builder builder(IndexMetadata indexMetadata) { + return new Builder(indexMetadata); } public static class Builder { @@ -932,9 +932,9 @@ public class IndexMetaData implements Diffable, ToXContentFragmen private long aliasesVersion = 1; private long[] primaryTerms = null; private Settings settings = Settings.Builder.EMPTY_SETTINGS; - private final ImmutableOpenMap.Builder mappings; - private final ImmutableOpenMap.Builder aliases; - private final ImmutableOpenMap.Builder customMetaData; + private final ImmutableOpenMap.Builder mappings; + private final ImmutableOpenMap.Builder aliases; + private final ImmutableOpenMap.Builder customMetadata; private final ImmutableOpenIntMap.Builder> inSyncAllocationIds; private final ImmutableOpenMap.Builder rolloverInfos; private Integer routingNumShards; @@ -943,26 +943,26 @@ public class IndexMetaData implements Diffable, ToXContentFragmen this.index = index; this.mappings = ImmutableOpenMap.builder(); this.aliases = ImmutableOpenMap.builder(); - this.customMetaData = ImmutableOpenMap.builder(); + this.customMetadata = ImmutableOpenMap.builder(); this.inSyncAllocationIds = ImmutableOpenIntMap.builder(); this.rolloverInfos = ImmutableOpenMap.builder(); } - public Builder(IndexMetaData indexMetaData) { - this.index = indexMetaData.getIndex().getName(); - this.state = indexMetaData.state; - this.version = indexMetaData.version; - this.mappingVersion = indexMetaData.mappingVersion; - this.settingsVersion = indexMetaData.settingsVersion; - this.aliasesVersion = indexMetaData.aliasesVersion; - this.settings = indexMetaData.getSettings(); - this.primaryTerms = indexMetaData.primaryTerms.clone(); - this.mappings = ImmutableOpenMap.builder(indexMetaData.mappings); - this.aliases = ImmutableOpenMap.builder(indexMetaData.aliases); - this.customMetaData = ImmutableOpenMap.builder(indexMetaData.customData); - this.routingNumShards = indexMetaData.routingNumShards; - this.inSyncAllocationIds = ImmutableOpenIntMap.builder(indexMetaData.inSyncAllocationIds); - this.rolloverInfos = ImmutableOpenMap.builder(indexMetaData.rolloverInfos); + public Builder(IndexMetadata indexMetadata) { + this.index = indexMetadata.getIndex().getName(); + this.state = indexMetadata.state; + this.version = indexMetadata.version; + this.mappingVersion = indexMetadata.mappingVersion; + this.settingsVersion = indexMetadata.settingsVersion; + this.aliasesVersion = indexMetadata.aliasesVersion; + this.settings = indexMetadata.getSettings(); + this.primaryTerms = indexMetadata.primaryTerms.clone(); + this.mappings = ImmutableOpenMap.builder(indexMetadata.mappings); + this.aliases = ImmutableOpenMap.builder(indexMetadata.aliases); + this.customMetadata = ImmutableOpenMap.builder(indexMetadata.customData); + this.routingNumShards = indexMetadata.routingNumShards; + this.inSyncAllocationIds = ImmutableOpenIntMap.builder(indexMetadata.inSyncAllocationIds); + this.rolloverInfos = ImmutableOpenMap.builder(indexMetadata.rolloverInfos); } public Builder index(String index) { @@ -1028,16 +1028,16 @@ public class IndexMetaData implements Diffable, ToXContentFragmen return this; } - public MappingMetaData mapping(String type) { + public MappingMetadata mapping(String type) { return mappings.get(type); } public Builder putMapping(String type, String source) throws IOException { - putMapping(new MappingMetaData(type, XContentHelper.convertToMap(XContentFactory.xContent(source), source, true))); + putMapping(new MappingMetadata(type, XContentHelper.convertToMap(XContentFactory.xContent(source), source, true))); return this; } - public Builder putMapping(MappingMetaData mappingMd) { + public Builder putMapping(MappingMetadata mappingMd) { mappings.put(mappingMd.type(), mappingMd); return this; } @@ -1047,13 +1047,13 @@ public class IndexMetaData implements Diffable, ToXContentFragmen return this; } - public Builder putAlias(AliasMetaData aliasMetaData) { - aliases.put(aliasMetaData.alias(), aliasMetaData); + public Builder putAlias(AliasMetadata aliasMetadata) { + aliases.put(aliasMetadata.alias(), aliasMetadata); return this; } - public Builder putAlias(AliasMetaData.Builder aliasMetaData) { - aliases.put(aliasMetaData.alias(), aliasMetaData.build()); + public Builder putAlias(AliasMetadata.Builder aliasMetadata) { + aliases.put(aliasMetadata.alias(), aliasMetadata.build()); return this; } @@ -1067,13 +1067,13 @@ public class IndexMetaData implements Diffable, ToXContentFragmen return this; } - public Builder putCustom(String type, Map customIndexMetaData) { - this.customMetaData.put(type, new DiffableStringMap(customIndexMetaData)); + public Builder putCustom(String type, Map customIndexMetadata) { + this.customMetadata.put(type, new DiffableStringMap(customIndexMetadata)); return this; } public Map removeCustom(String type) { - return this.customMetaData.remove(type); + return this.customMetadata.remove(type); } public Set getInSyncAllocationIds(int shardId) { @@ -1128,7 +1128,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen /** * returns the primary term for the given shard. - * See {@link IndexMetaData#primaryTerm(int)} for more information. + * See {@link IndexMetadata#primaryTerm(int)} for more information. */ public long primaryTerm(int shardId) { if (primaryTerms == null) { @@ -1139,7 +1139,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen /** * sets the primary term for the given shard. - * See {@link IndexMetaData#primaryTerm(int)} for more information. + * See {@link IndexMetadata#primaryTerm(int)} for more information. */ public Builder primaryTerm(int shardId, long primaryTerm) { if (primaryTerms == null) { @@ -1163,14 +1163,14 @@ public class IndexMetaData implements Diffable, ToXContentFragmen } - public IndexMetaData build() { - ImmutableOpenMap.Builder tmpAliases = aliases; + public IndexMetadata build() { + ImmutableOpenMap.Builder tmpAliases = aliases; Settings tmpSettings = settings; - // update default mapping on the MappingMetaData + // update default mapping on the MappingMetadata if (mappings.containsKey(MapperService.DEFAULT_MAPPING)) { - MappingMetaData defaultMapping = mappings.get(MapperService.DEFAULT_MAPPING); - for (ObjectCursor cursor : mappings.values()) { + MappingMetadata defaultMapping = mappings.get(MapperService.DEFAULT_MAPPING); + for (ObjectCursor cursor : mappings.values()) { cursor.value.updateDefaultMapping(defaultMapping); } } @@ -1236,7 +1236,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen initialRecoveryFilters = DiscoveryNodeFilters.buildFromKeyValue(OR, initialRecoveryMap); } Version indexCreatedVersion = Version.indexCreated(settings); - Version indexUpgradedVersion = settings.getAsVersion(IndexMetaData.SETTING_VERSION_UPGRADED, indexCreatedVersion); + Version indexUpgradedVersion = settings.getAsVersion(IndexMetadata.SETTING_VERSION_UPGRADED, indexCreatedVersion); if (primaryTerms == null) { initializePrimaryTerms(); @@ -1254,7 +1254,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen final String uuid = settings.get(SETTING_INDEX_UUID, INDEX_UUID_NA_VALUE); - return new IndexMetaData( + return new IndexMetadata( new Index(index, uuid), version, mappingVersion, @@ -1267,7 +1267,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen tmpSettings, mappings.build(), tmpAliases.build(), - customMetaData.build(), + customMetadata.build(), filledInSyncAllocationIds.build(), requireFilters, initialRecoveryFilters, @@ -1281,33 +1281,33 @@ public class IndexMetaData implements Diffable, ToXContentFragmen rolloverInfos.build()); } - public static void toXContent(IndexMetaData indexMetaData, XContentBuilder builder, ToXContent.Params params) throws IOException { - MetaData.XContentContext context = MetaData.XContentContext.valueOf( - params.param(CONTEXT_MODE_PARAM, MetaData.CONTEXT_MODE_API)); + public static void toXContent(IndexMetadata indexMetadata, XContentBuilder builder, ToXContent.Params params) throws IOException { + Metadata.XContentContext context = Metadata.XContentContext.valueOf( + params.param(CONTEXT_MODE_PARAM, Metadata.CONTEXT_MODE_API)); - builder.startObject(indexMetaData.getIndex().getName()); + builder.startObject(indexMetadata.getIndex().getName()); - builder.field(KEY_VERSION, indexMetaData.getVersion()); - builder.field(KEY_MAPPING_VERSION, indexMetaData.getMappingVersion()); - builder.field(KEY_SETTINGS_VERSION, indexMetaData.getSettingsVersion()); - builder.field(KEY_ALIASES_VERSION, indexMetaData.getAliasesVersion()); - builder.field(KEY_ROUTING_NUM_SHARDS, indexMetaData.getRoutingNumShards()); + builder.field(KEY_VERSION, indexMetadata.getVersion()); + builder.field(KEY_MAPPING_VERSION, indexMetadata.getMappingVersion()); + builder.field(KEY_SETTINGS_VERSION, indexMetadata.getSettingsVersion()); + builder.field(KEY_ALIASES_VERSION, indexMetadata.getAliasesVersion()); + builder.field(KEY_ROUTING_NUM_SHARDS, indexMetadata.getRoutingNumShards()); - builder.field(KEY_STATE, indexMetaData.getState().toString().toLowerCase(Locale.ENGLISH)); + builder.field(KEY_STATE, indexMetadata.getState().toString().toLowerCase(Locale.ENGLISH)); boolean binary = params.paramAsBoolean("binary", false); builder.startObject(KEY_SETTINGS); - if (context != MetaData.XContentContext.API) { - indexMetaData.getSettings().toXContent(builder, new MapParams(Collections.singletonMap("flat_settings", "true"))); + if (context != Metadata.XContentContext.API) { + indexMetadata.getSettings().toXContent(builder, new MapParams(Collections.singletonMap("flat_settings", "true"))); } else { - indexMetaData.getSettings().toXContent(builder, params); + indexMetadata.getSettings().toXContent(builder, params); } builder.endObject(); - if (context != MetaData.XContentContext.API) { + if (context != Metadata.XContentContext.API) { builder.startArray(KEY_MAPPINGS); - for (ObjectObjectCursor cursor : indexMetaData.getMappings()) { + for (ObjectObjectCursor cursor : indexMetadata.getMappings()) { if (binary) { builder.value(cursor.value.source().compressed()); } else { @@ -1317,7 +1317,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen builder.endArray(); } else { builder.startObject(KEY_MAPPINGS); - for (ObjectObjectCursor cursor : indexMetaData.getMappings()) { + for (ObjectObjectCursor cursor : indexMetadata.getMappings()) { Map mapping = XContentHelper .convertToMap(new BytesArray(cursor.value.source().uncompressed()), false).v2(); if (mapping.size() == 1 && mapping.containsKey(cursor.key)) { @@ -1330,40 +1330,40 @@ public class IndexMetaData implements Diffable, ToXContentFragmen builder.endObject(); } - for (ObjectObjectCursor cursor : indexMetaData.customData) { + for (ObjectObjectCursor cursor : indexMetadata.customData) { builder.field(cursor.key); builder.map(cursor.value); } - if (context != MetaData.XContentContext.API) { + if (context != Metadata.XContentContext.API) { builder.startObject(KEY_ALIASES); - for (ObjectCursor cursor : indexMetaData.getAliases().values()) { - AliasMetaData.Builder.toXContent(cursor.value, builder, params); + for (ObjectCursor cursor : indexMetadata.getAliases().values()) { + AliasMetadata.Builder.toXContent(cursor.value, builder, params); } builder.endObject(); builder.startArray(KEY_PRIMARY_TERMS); - for (int i = 0; i < indexMetaData.getNumberOfShards(); i++) { - builder.value(indexMetaData.primaryTerm(i)); + for (int i = 0; i < indexMetadata.getNumberOfShards(); i++) { + builder.value(indexMetadata.primaryTerm(i)); } builder.endArray(); } else { builder.startArray(KEY_ALIASES); - for (ObjectCursor cursor : indexMetaData.getAliases().keys()) { + for (ObjectCursor cursor : indexMetadata.getAliases().keys()) { builder.value(cursor.value); } builder.endArray(); - builder.startObject(IndexMetaData.KEY_PRIMARY_TERMS); - for (int shard = 0; shard < indexMetaData.getNumberOfShards(); shard++) { - builder.field(Integer.toString(shard), indexMetaData.primaryTerm(shard)); + builder.startObject(IndexMetadata.KEY_PRIMARY_TERMS); + for (int shard = 0; shard < indexMetadata.getNumberOfShards(); shard++) { + builder.field(Integer.toString(shard), indexMetadata.primaryTerm(shard)); } builder.endObject(); } builder.startObject(KEY_IN_SYNC_ALLOCATIONS); - for (IntObjectCursor> cursor : indexMetaData.inSyncAllocationIds) { + for (IntObjectCursor> cursor : indexMetadata.inSyncAllocationIds) { builder.startArray(String.valueOf(cursor.key)); for (String allocationId : cursor.value) { builder.value(allocationId); @@ -1373,7 +1373,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen builder.endObject(); builder.startObject(KEY_ROLLOVER_INFOS); - for (ObjectCursor cursor : indexMetaData.getRolloverInfos().values()) { + for (ObjectCursor cursor : indexMetadata.getRolloverInfos().values()) { cursor.value.toXContent(builder, params); } builder.endObject(); @@ -1381,7 +1381,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen builder.endObject(); } - public static IndexMetaData fromXContent(XContentParser parser) throws IOException { + public static IndexMetadata fromXContent(XContentParser parser) throws IOException { if (parser.currentToken() == null) { // fresh parser? move to the first token parser.nextToken(); } @@ -1415,14 +1415,14 @@ public class IndexMetaData implements Diffable, ToXContentFragmen String mappingType = currentFieldName; Map mappingSource = MapBuilder.newMapBuilder().put(mappingType, parser.mapOrdered()).map(); - builder.putMapping(new MappingMetaData(mappingType, mappingSource)); + builder.putMapping(new MappingMetadata(mappingType, mappingSource)); } else { throw new IllegalArgumentException("Unexpected token: " + token); } } } else if (KEY_ALIASES.equals(currentFieldName)) { while (parser.nextToken() != XContentParser.Token.END_OBJECT) { - builder.putAlias(AliasMetaData.Builder.fromXContent(parser)); + builder.putAlias(AliasMetadata.Builder.fromXContent(parser)); } } else if (KEY_IN_SYNC_ALLOCATIONS.equals(currentFieldName)) { while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { @@ -1466,12 +1466,12 @@ public class IndexMetaData implements Diffable, ToXContentFragmen if (KEY_MAPPINGS.equals(currentFieldName)) { while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { if (token == XContentParser.Token.VALUE_EMBEDDED_OBJECT) { - builder.putMapping(new MappingMetaData(new CompressedXContent(parser.binaryValue()))); + builder.putMapping(new MappingMetadata(new CompressedXContent(parser.binaryValue()))); } else { Map mapping = parser.mapOrdered(); if (mapping.size() == 1) { String mappingType = mapping.keySet().iterator().next(); - builder.putMapping(new MappingMetaData(mappingType, mapping)); + builder.putMapping(new MappingMetadata(mappingType, mapping)); } } } @@ -1550,29 +1550,29 @@ public class IndexMetaData implements Diffable, ToXContentFragmen static { Map params = new HashMap<>(2); params.put("binary", "true"); - params.put(MetaData.CONTEXT_MODE_PARAM, MetaData.CONTEXT_MODE_GATEWAY); + params.put(Metadata.CONTEXT_MODE_PARAM, Metadata.CONTEXT_MODE_GATEWAY); FORMAT_PARAMS = new MapParams(params); } /** - * State format for {@link IndexMetaData} to write to and load from disk + * State format for {@link IndexMetadata} to write to and load from disk */ - public static final MetaDataStateFormat FORMAT = new MetaDataStateFormat(INDEX_STATE_FILE_PREFIX) { + public static final MetadataStateFormat FORMAT = new MetadataStateFormat(INDEX_STATE_FILE_PREFIX) { @Override - public void toXContent(XContentBuilder builder, IndexMetaData state) throws IOException { + public void toXContent(XContentBuilder builder, IndexMetadata state) throws IOException { Builder.toXContent(state, builder, FORMAT_PARAMS); } @Override - public IndexMetaData fromXContent(XContentParser parser) throws IOException { + public IndexMetadata fromXContent(XContentParser parser) throws IOException { return Builder.fromXContent(parser); } }; /** * Returns the number of shards that should be used for routing. This basically defines the hash space we use in - * {@link org.elasticsearch.cluster.routing.OperationRouting#generateShardId(IndexMetaData, String, String)} to route documents + * {@link org.elasticsearch.cluster.routing.OperationRouting#generateShardId(IndexMetadata, String, String)} to route documents * to shards based on their ID or their specific routing value. The default value is {@link #getNumberOfShards()}. This value only * changes if and index is shrunk. */ @@ -1596,7 +1596,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen * @param numTargetShards the total number of shards in the target index * @return a the source shard ID to split off from */ - public static ShardId selectSplitShard(int shardId, IndexMetaData sourceIndexMetadata, int numTargetShards) { + public static ShardId selectSplitShard(int shardId, IndexMetadata sourceIndexMetadata, int numTargetShards) { int numSourceShards = sourceIndexMetadata.getNumberOfShards(); if (shardId >= numTargetShards) { throw new IllegalArgumentException("the number of target shards (" + numTargetShards + ") must be greater than the shard id: " @@ -1614,7 +1614,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen * @param numTargetShards the total number of shards in the target index * @return a the source shard ID to clone from */ - public static ShardId selectCloneShard(int shardId, IndexMetaData sourceIndexMetadata, int numTargetShards) { + public static ShardId selectCloneShard(int shardId, IndexMetadata sourceIndexMetadata, int numTargetShards) { int numSourceShards = sourceIndexMetadata.getNumberOfShards(); if (numSourceShards != numTargetShards) { throw new IllegalArgumentException("the number of target shards (" + numTargetShards + ") must be the same as the number of " @@ -1623,7 +1623,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen return new ShardId(sourceIndexMetadata.getIndex(), shardId); } - private static void assertSplitMetadata(int numSourceShards, int numTargetShards, IndexMetaData sourceIndexMetadata) { + private static void assertSplitMetadata(int numSourceShards, int numTargetShards, IndexMetadata sourceIndexMetadata) { if (numSourceShards > numTargetShards) { throw new IllegalArgumentException("the number of source shards [" + numSourceShards + "] must be less that the number of target shards [" + numTargetShards + "]"); @@ -1648,7 +1648,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen * @param sourceIndexMetadata the source metadata * @param numTargetShards the number of target shards */ - public static Set selectRecoverFromShards(int shardId, IndexMetaData sourceIndexMetadata, int numTargetShards) { + public static Set selectRecoverFromShards(int shardId, IndexMetadata sourceIndexMetadata, int numTargetShards) { if (sourceIndexMetadata.getNumberOfShards() > numTargetShards) { return selectShrinkShards(shardId, sourceIndexMetadata, numTargetShards); } else if (sourceIndexMetadata.getNumberOfShards() < numTargetShards) { @@ -1665,7 +1665,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen * @param numTargetShards the total number of shards in the target index * @return a set of shard IDs to shrink into the given shard ID. */ - public static Set selectShrinkShards(int shardId, IndexMetaData sourceIndexMetadata, int numTargetShards) { + public static Set selectShrinkShards(int shardId, IndexMetadata sourceIndexMetadata, int numTargetShards) { if (shardId >= numTargetShards) { throw new IllegalArgumentException("the number of target shards (" + numTargetShards + ") must be greater than the shard id: " + shardId); @@ -1685,7 +1685,7 @@ public class IndexMetaData implements Diffable, ToXContentFragmen /** * Returns the routing factor for and shrunk index with the given number of target shards. * This factor is used in the hash function in - * {@link org.elasticsearch.cluster.routing.OperationRouting#generateShardId(IndexMetaData, String, String)} to guarantee consistent + * {@link org.elasticsearch.cluster.routing.OperationRouting#generateShardId(IndexMetadata, String, String)} to guarantee consistent * hashing / routing of documents even if the number of shards changed (ie. a shrunk index). * * @param sourceNumberOfShards the total number of shards in the source index diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java index 0590099841d..6f8c74f6c1c 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java @@ -149,9 +149,9 @@ public class IndexNameExpressionResolver { Index[] concreteIndices(Context context, String... indexExpressions) { if (indexExpressions == null || indexExpressions.length == 0) { - indexExpressions = new String[]{MetaData.ALL}; + indexExpressions = new String[]{Metadata.ALL}; } - MetaData metaData = context.getState().metaData(); + Metadata metadata = context.getState().metadata(); IndicesOptions options = context.getOptions(); final boolean failClosed = options.forbidClosedIndices() && options.ignoreUnavailable() == false; // If only one index is specified then whether we fail a request if an index is missing depends on the allow_no_indices @@ -167,7 +167,7 @@ public class IndexNameExpressionResolver { if (!options.allowNoIndices()) { IndexNotFoundException infe; if (indexExpressions.length == 1) { - if (indexExpressions[0].equals(MetaData.ALL)) { + if (indexExpressions[0].equals(Metadata.ALL)) { infe = new IndexNotFoundException("no indices exist", (String)null); } else { infe = new IndexNotFoundException((String)null); @@ -184,11 +184,11 @@ public class IndexNameExpressionResolver { final Set concreteIndices = new HashSet<>(expressions.size()); for (String expression : expressions) { - IndexAbstraction indexAbstraction = metaData.getIndicesLookup().get(expression); + IndexAbstraction indexAbstraction = metadata.getIndicesLookup().get(expression); if (indexAbstraction == null ) { if (failNoIndices) { IndexNotFoundException infe; - if (expression.equals(MetaData.ALL)) { + if (expression.equals(Metadata.ALL)) { infe = new IndexNotFoundException("no indices exist", expression); } else { infe = new IndexNotFoundException(expression); @@ -207,7 +207,7 @@ public class IndexNameExpressionResolver { } if (indexAbstraction.getType() == IndexAbstraction.Type.ALIAS && context.isResolveToWriteIndex()) { - IndexMetaData writeIndex = indexAbstraction.getWriteIndex(); + IndexMetadata writeIndex = indexAbstraction.getWriteIndex(); if (writeIndex == null) { throw new IllegalArgumentException("no write index is defined for alias [" + indexAbstraction.getName() + "]." + " The write index may be explicitly disabled using is_write_index=false or the alias points to multiple" + @@ -220,15 +220,15 @@ public class IndexNameExpressionResolver { if (indexAbstraction.getIndices().size() > 1 && !options.allowAliasesToMultipleIndices()) { String[] indexNames = new String[indexAbstraction.getIndices().size()]; int i = 0; - for (IndexMetaData indexMetaData : indexAbstraction.getIndices()) { - indexNames[i++] = indexMetaData.getIndex().getName(); + for (IndexMetadata indexMetadata : indexAbstraction.getIndices()) { + indexNames[i++] = indexMetadata.getIndex().getName(); } throw new IllegalArgumentException("Alias [" + expression + "] has more than one indices associated with it [" + Arrays.toString(indexNames) + "], can't execute a single index op"); } - for (IndexMetaData index : indexAbstraction.getIndices()) { - if (index.getState() == IndexMetaData.State.CLOSE) { + for (IndexMetadata index : indexAbstraction.getIndices()) { + if (index.getState() == IndexMetadata.State.CLOSE) { if (failClosed) { throw new IndexClosedException(index.getIndex()); } else { @@ -236,7 +236,7 @@ public class IndexNameExpressionResolver { concreteIndices.add(index.getIndex()); } } - } else if (index.getState() == IndexMetaData.State.OPEN) { + } else if (index.getState() == IndexMetadata.State.OPEN) { if (addIndex(index, context)) { concreteIndices.add(index.getIndex()); } @@ -255,8 +255,8 @@ public class IndexNameExpressionResolver { return concreteIndices.toArray(new Index[concreteIndices.size()]); } - private static boolean addIndex(IndexMetaData metaData, Context context) { - return (context.options.ignoreThrottled() && IndexSettings.INDEX_SEARCH_THROTTLED.get(metaData.getSettings())) == false; + private static boolean addIndex(IndexMetadata metadata, Context context) { + return (context.options.ignoreThrottled() && IndexSettings.INDEX_SEARCH_THROTTLED.get(metadata.getSettings())) == false; } private static IllegalArgumentException aliasesNotSupportedException(String expression) { @@ -331,7 +331,7 @@ public class IndexNameExpressionResolver { public boolean hasIndexOrAlias(String aliasOrIndex, ClusterState state) { Context context = new Context(state, IndicesOptions.lenientExpandOpen()); String resolvedAliasOrIndex = dateMathExpressionResolver.resolveExpression(aliasOrIndex, context); - return state.metaData().getIndicesLookup().containsKey(resolvedAliasOrIndex); + return state.metadata().getIndicesLookup().containsKey(resolvedAliasOrIndex); } /** @@ -363,7 +363,7 @@ public class IndexNameExpressionResolver { * NOTE: The provided expressions must have been resolved already via {@link #resolveExpressions}. */ public String[] filteringAliases(ClusterState state, String index, Set resolvedExpressions) { - return indexAliases(state, index, AliasMetaData::filteringRequired, false, resolvedExpressions); + return indexAliases(state, index, AliasMetadata::filteringRequired, false, resolvedExpressions); } /** @@ -382,14 +382,14 @@ public class IndexNameExpressionResolver { * the index itself - null is returned. Returns {@code null} if no filtering is required. *

NOTE: the provided expressions must have been resolved already via {@link #resolveExpressions}. */ - public String[] indexAliases(ClusterState state, String index, Predicate requiredAlias, boolean skipIdentity, + public String[] indexAliases(ClusterState state, String index, Predicate requiredAlias, boolean skipIdentity, Set resolvedExpressions) { if (isAllIndices(resolvedExpressions)) { return null; } - final IndexMetaData indexMetaData = state.metaData().getIndices().get(index); - if (indexMetaData == null) { + final IndexMetadata indexMetadata = state.metadata().getIndices().get(index); + if (indexMetadata == null) { // Shouldn't happen throw new IndexNotFoundException(index); } @@ -398,30 +398,30 @@ public class IndexNameExpressionResolver { return null; } - final ImmutableOpenMap indexAliases = indexMetaData.getAliases(); - final AliasMetaData[] aliasCandidates; + final ImmutableOpenMap indexAliases = indexMetadata.getAliases(); + final AliasMetadata[] aliasCandidates; if (iterateIndexAliases(indexAliases.size(), resolvedExpressions.size())) { // faster to iterate indexAliases aliasCandidates = StreamSupport.stream(Spliterators.spliteratorUnknownSize(indexAliases.values().iterator(), 0), false) .map(cursor -> cursor.value) - .filter(aliasMetaData -> resolvedExpressions.contains(aliasMetaData.alias())) - .toArray(AliasMetaData[]::new); + .filter(aliasMetadata -> resolvedExpressions.contains(aliasMetadata.alias())) + .toArray(AliasMetadata[]::new); } else { // faster to iterate resolvedExpressions aliasCandidates = resolvedExpressions.stream() .map(indexAliases::get) .filter(Objects::nonNull) - .toArray(AliasMetaData[]::new); + .toArray(AliasMetadata[]::new); } List aliases = null; - for (AliasMetaData aliasMetaData : aliasCandidates) { - if (requiredAlias.test(aliasMetaData)) { + for (AliasMetadata aliasMetadata : aliasCandidates) { + if (requiredAlias.test(aliasMetadata)) { // If required - add it to the list of aliases if (aliases == null) { aliases = new ArrayList<>(); } - aliases.add(aliasMetaData.alias()); + aliases.add(aliasMetadata.alias()); } else { // If not, we have a non required alias for this index - no further checking needed return null; @@ -448,7 +448,7 @@ public class IndexNameExpressionResolver { // TODO: it appears that this can never be true? if (isAllIndices(resolvedExpressions)) { - return resolveSearchRoutingAllIndices(state.metaData(), routing); + return resolveSearchRoutingAllIndices(state.metadata(), routing); } Map> routings = null; @@ -460,14 +460,14 @@ public class IndexNameExpressionResolver { } for (String expression : resolvedExpressions) { - IndexAbstraction indexAbstraction = state.metaData().getIndicesLookup().get(expression); + IndexAbstraction indexAbstraction = state.metadata().getIndicesLookup().get(expression); if (indexAbstraction != null && indexAbstraction.getType() == IndexAbstraction.Type.ALIAS) { IndexAbstraction.Alias alias = (IndexAbstraction.Alias) indexAbstraction; - for (Tuple item : alias.getConcreteIndexAndAliasMetaDatas()) { + for (Tuple item : alias.getConcreteIndexAndAliasMetadatas()) { String concreteIndex = item.v1(); - AliasMetaData aliasMetaData = item.v2(); + AliasMetadata aliasMetadata = item.v2(); if (!norouting.contains(concreteIndex)) { - if (!aliasMetaData.searchRoutingValues().isEmpty()) { + if (!aliasMetadata.searchRoutingValues().isEmpty()) { // Routing alias if (routings == null) { routings = new HashMap<>(); @@ -477,7 +477,7 @@ public class IndexNameExpressionResolver { r = new HashSet<>(); routings.put(concreteIndex, r); } - r.addAll(aliasMetaData.searchRoutingValues()); + r.addAll(aliasMetadata.searchRoutingValues()); if (paramRouting != null) { r.retainAll(paramRouting); } @@ -531,11 +531,11 @@ public class IndexNameExpressionResolver { /** * Sets the same routing for all indices */ - public Map> resolveSearchRoutingAllIndices(MetaData metaData, String routing) { + public Map> resolveSearchRoutingAllIndices(Metadata metadata, String routing) { if (routing != null) { Set r = Sets.newHashSet(Strings.splitStringByCommaToArray(routing)); Map> routings = new HashMap<>(); - String[] concreteIndices = metaData.getConcreteAllIndices(); + String[] concreteIndices = metadata.getConcreteAllIndices(); for (String index : concreteIndices) { routings.put(index, r); } @@ -563,7 +563,7 @@ public class IndexNameExpressionResolver { * @return true if the provided array explicitly maps to all indices, false otherwise */ static boolean isExplicitAllPattern(Collection aliasesOrIndices) { - return aliasesOrIndices != null && aliasesOrIndices.size() == 1 && MetaData.ALL.equals(aliasesOrIndices.iterator().next()); + return aliasesOrIndices != null && aliasesOrIndices.size() == 1 && Metadata.ALL.equals(aliasesOrIndices.iterator().next()); } /** @@ -573,9 +573,9 @@ public class IndexNameExpressionResolver { * @param concreteIndices array containing the concrete indices that the first argument refers to * @return true if the first argument is a pattern that maps to all available indices, false otherwise */ - boolean isPatternMatchingAllIndices(MetaData metaData, String[] indicesOrAliases, String[] concreteIndices) { + boolean isPatternMatchingAllIndices(Metadata metadata, String[] indicesOrAliases, String[] concreteIndices) { // if we end up matching on all indices, check, if its a wildcard parameter, or a "-something" structure - if (concreteIndices.length == metaData.getConcreteAllIndices().length && indicesOrAliases.length > 0) { + if (concreteIndices.length == metadata.getConcreteAllIndices().length && indicesOrAliases.length > 0) { //we might have something like /-test1,+test1 that would identify all indices //or something like /-test1 with test1 index missing and IndicesOptions.lenient() @@ -672,7 +672,7 @@ public class IndexNameExpressionResolver { @Override public List resolve(Context context, List expressions) { IndicesOptions options = context.getOptions(); - MetaData metaData = context.getState().metaData(); + Metadata metadata = context.getState().metadata(); // only check open/closed since if we do not expand to open or closed it doesn't make sense to // expand to hidden if (options.expandWildcardsClosed() == false && options.expandWildcardsOpen() == false) { @@ -680,10 +680,10 @@ public class IndexNameExpressionResolver { } if (isEmptyOrTrivialWildcard(expressions)) { - return resolveEmptyOrTrivialWildcard(options, metaData); + return resolveEmptyOrTrivialWildcard(options, metadata); } - Set result = innerResolve(context, expressions, options, metaData); + Set result = innerResolve(context, expressions, options, metadata); if (result == null) { return expressions; @@ -696,7 +696,7 @@ public class IndexNameExpressionResolver { return new ArrayList<>(result); } - private Set innerResolve(Context context, List expressions, IndicesOptions options, MetaData metaData) { + private Set innerResolve(Context context, List expressions, IndicesOptions options, Metadata metadata) { Set result = null; boolean wildcardSeen = false; for (int i = 0; i < expressions.size(); i++) { @@ -705,7 +705,7 @@ public class IndexNameExpressionResolver { throw indexNotFoundException(expression); } validateAliasOrIndex(expression); - if (aliasOrIndexExists(options, metaData, expression)) { + if (aliasOrIndexExists(options, metadata, expression)) { if (result != null) { result.add(expression); } @@ -725,7 +725,7 @@ public class IndexNameExpressionResolver { if (Regex.isSimpleMatchPattern(expression) == false) { //TODO why does wildcard resolver throw exceptions regarding non wildcarded expressions? This should not be done here. if (options.ignoreUnavailable() == false) { - IndexAbstraction indexAbstraction = metaData.getIndicesLookup().get(expression); + IndexAbstraction indexAbstraction = metadata.getIndicesLookup().get(expression); if (indexAbstraction == null) { throw indexNotFoundException(expression); } else if (indexAbstraction.getType() == IndexAbstraction.Type.ALIAS && options.ignoreAliases()) { @@ -740,8 +740,8 @@ public class IndexNameExpressionResolver { continue; } - final IndexMetaData.State excludeState = excludeState(options); - final Map matches = matches(context, metaData, expression); + final IndexMetadata.State excludeState = excludeState(options); + final Map matches = matches(context, metadata, expression); Set expand = expand(context, excludeState, matches, expression, options.expandWildcardsHidden()); if (add) { result.addAll(expand); @@ -768,8 +768,8 @@ public class IndexNameExpressionResolver { } } - private static boolean aliasOrIndexExists(IndicesOptions options, MetaData metaData, String expression) { - IndexAbstraction indexAbstraction = metaData.getIndicesLookup().get(expression); + private static boolean aliasOrIndexExists(IndicesOptions options, Metadata metadata, String expression) { + IndexAbstraction indexAbstraction = metadata.getIndicesLookup().get(expression); //treat aliases as unavailable indices when ignoreAliases is set to true (e.g. delete index and update aliases api) return indexAbstraction != null && (options.ignoreAliases() == false || indexAbstraction.getType() != IndexAbstraction.Type.ALIAS); @@ -781,14 +781,14 @@ public class IndexNameExpressionResolver { return infe; } - private static IndexMetaData.State excludeState(IndicesOptions options) { - final IndexMetaData.State excludeState; + private static IndexMetadata.State excludeState(IndicesOptions options) { + final IndexMetadata.State excludeState; if (options.expandWildcardsOpen() && options.expandWildcardsClosed()) { excludeState = null; } else if (options.expandWildcardsOpen() && options.expandWildcardsClosed() == false) { - excludeState = IndexMetaData.State.CLOSE; + excludeState = IndexMetadata.State.CLOSE; } else if (options.expandWildcardsClosed() && options.expandWildcardsOpen() == false) { - excludeState = IndexMetaData.State.OPEN; + excludeState = IndexMetadata.State.OPEN; } else { assert false : "this shouldn't get called if wildcards expand to none"; excludeState = null; @@ -796,30 +796,30 @@ public class IndexNameExpressionResolver { return excludeState; } - public static Map matches(Context context, MetaData metaData, String expression) { + public static Map matches(Context context, Metadata metadata, String expression) { if (Regex.isMatchAllPattern(expression)) { // Can only happen if the expressions was initially: '-*' if (context.getOptions().ignoreAliases()) { - return metaData.getIndicesLookup().entrySet().stream() + return metadata.getIndicesLookup().entrySet().stream() .filter(e -> e.getValue().getType() != IndexAbstraction.Type.ALIAS) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); } else { - return metaData.getIndicesLookup(); + return metadata.getIndicesLookup(); } } else if (expression.indexOf("*") == expression.length() - 1) { - return suffixWildcard(context, metaData, expression); + return suffixWildcard(context, metadata, expression); } else { - return otherWildcard(context, metaData, expression); + return otherWildcard(context, metadata, expression); } } - private static Map suffixWildcard(Context context, MetaData metaData, String expression) { + private static Map suffixWildcard(Context context, Metadata metadata, String expression) { assert expression.length() >= 2 : "expression [" + expression + "] should have at least a length of 2"; String fromPrefix = expression.substring(0, expression.length() - 1); char[] toPrefixCharArr = fromPrefix.toCharArray(); toPrefixCharArr[toPrefixCharArr.length - 1]++; String toPrefix = new String(toPrefixCharArr); - SortedMap subMap = metaData.getIndicesLookup().subMap(fromPrefix, toPrefix); + SortedMap subMap = metadata.getIndicesLookup().subMap(fromPrefix, toPrefix); if (context.getOptions().ignoreAliases()) { return subMap.entrySet().stream() .filter(entry -> entry.getValue().getType() != IndexAbstraction.Type.ALIAS) @@ -828,9 +828,9 @@ public class IndexNameExpressionResolver { return subMap; } - private static Map otherWildcard(Context context, MetaData metaData, String expression) { + private static Map otherWildcard(Context context, Metadata metadata, String expression) { final String pattern = expression; - return metaData.getIndicesLookup() + return metadata.getIndicesLookup() .entrySet() .stream() .filter(e -> context.getOptions().ignoreAliases() == false || e.getValue().getType() != IndexAbstraction.Type.ALIAS) @@ -838,7 +838,7 @@ public class IndexNameExpressionResolver { .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); } - private static Set expand(Context context, IndexMetaData.State excludeState, Map matches, + private static Set expand(Context context, IndexMetadata.State excludeState, Map matches, String expression, boolean includeHidden) { Set expand = new HashSet<>(); for (Map.Entry entry : matches.entrySet()) { @@ -849,7 +849,7 @@ public class IndexNameExpressionResolver { if (context.isPreserveAliases() && indexAbstraction.getType() == IndexAbstraction.Type.ALIAS) { expand.add(aliasOrIndexName); } else { - for (IndexMetaData meta : indexAbstraction.getIndices()) { + for (IndexMetadata meta : indexAbstraction.getIndices()) { if (excludeState == null || meta.getState() != excludeState) { expand.add(meta.getIndex().getName()); } @@ -866,23 +866,23 @@ public class IndexNameExpressionResolver { } private boolean isEmptyOrTrivialWildcard(List expressions) { - return expressions.isEmpty() || (expressions.size() == 1 && (MetaData.ALL.equals(expressions.get(0)) || + return expressions.isEmpty() || (expressions.size() == 1 && (Metadata.ALL.equals(expressions.get(0)) || Regex.isMatchAllPattern(expressions.get(0)))); } - private static List resolveEmptyOrTrivialWildcard(IndicesOptions options, MetaData metaData) { + private static List resolveEmptyOrTrivialWildcard(IndicesOptions options, Metadata metadata) { if (options.expandWildcardsOpen() && options.expandWildcardsClosed() && options.expandWildcardsHidden()) { - return Arrays.asList(metaData.getConcreteAllIndices()); + return Arrays.asList(metadata.getConcreteAllIndices()); } else if (options.expandWildcardsOpen() && options.expandWildcardsClosed()) { - return Arrays.asList(metaData.getConcreteVisibleIndices()); + return Arrays.asList(metadata.getConcreteVisibleIndices()); } else if (options.expandWildcardsOpen() && options.expandWildcardsHidden()) { - return Arrays.asList(metaData.getConcreteAllOpenIndices()); + return Arrays.asList(metadata.getConcreteAllOpenIndices()); } else if (options.expandWildcardsOpen()) { - return Arrays.asList(metaData.getConcreteVisibleOpenIndices()); + return Arrays.asList(metadata.getConcreteVisibleOpenIndices()); } else if (options.expandWildcardsClosed() && options.expandWildcardsHidden()) { - return Arrays.asList(metaData.getConcreteAllClosedIndices()); + return Arrays.asList(metadata.getConcreteAllClosedIndices()); } else if (options.expandWildcardsClosed()) { - return Arrays.asList(metaData.getConcreteVisibleClosedIndices()); + return Arrays.asList(metadata.getConcreteVisibleClosedIndices()); } else { return Collections.emptyList(); } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetadata.java similarity index 85% rename from server/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java rename to server/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetadata.java index 0636c19e75e..d6f4f878f59 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetadata.java @@ -51,11 +51,11 @@ import java.util.Map; import java.util.Objects; import java.util.Set; -import static org.elasticsearch.cluster.metadata.MetaData.CONTEXT_MODE_PARAM; +import static org.elasticsearch.cluster.metadata.Metadata.CONTEXT_MODE_PARAM; -public class IndexTemplateMetaData extends AbstractDiffable { +public class IndexTemplateMetadata extends AbstractDiffable { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(IndexTemplateMetaData.class)); + private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(IndexTemplateMetadata.class)); private final String name; @@ -88,12 +88,12 @@ public class IndexTemplateMetaData extends AbstractDiffable mappings; - private final ImmutableOpenMap aliases; + private final ImmutableOpenMap aliases; - public IndexTemplateMetaData(String name, int order, Integer version, + public IndexTemplateMetadata(String name, int order, Integer version, List patterns, Settings settings, ImmutableOpenMap mappings, - ImmutableOpenMap aliases) { + ImmutableOpenMap aliases) { if (patterns == null || patterns.isEmpty()) { throw new IllegalArgumentException("Index patterns must not be null or empty; got " + patterns); } @@ -153,11 +153,11 @@ public class IndexTemplateMetaData extends AbstractDiffable aliases() { + public ImmutableOpenMap aliases() { return this.aliases; } - public ImmutableOpenMap getAliases() { + public ImmutableOpenMap getAliases() { return this.aliases; } @@ -170,7 +170,7 @@ public class IndexTemplateMetaData extends AbstractDiffable readDiffFrom(StreamInput in) throws IOException { - return readDiffFrom(IndexTemplateMetaData::readFrom, in); + public static Diff readDiffFrom(StreamInput in) throws IOException { + return readDiffFrom(IndexTemplateMetadata::readFrom, in); } @Override @@ -242,7 +242,7 @@ public class IndexTemplateMetaData extends AbstractDiffable cursor : aliases.values()) { + for (ObjectCursor cursor : aliases.values()) { cursor.value.writeTo(out); } if (out.getVersion().before(Version.V_6_5_0)) { @@ -268,7 +268,7 @@ public class IndexTemplateMetaData extends AbstractDiffable mappings; - private final ImmutableOpenMap.Builder aliases; + private final ImmutableOpenMap.Builder aliases; public Builder(String name) { this.name = name; @@ -276,15 +276,15 @@ public class IndexTemplateMetaData extends AbstractDiffable cursor1 : indexTemplateMetaData.mappings()) { + for (ObjectObjectCursor cursor1 : indexTemplateMetadata.mappings()) { Map mapping = XContentHelper.convertToMap(new BytesArray(cursor1.value.uncompressed()), false).v2(); if (mapping.size() == 1 && mapping.containsKey(cursor1.key)) { // the type name is the root value, reduce it @@ -422,7 +422,7 @@ public class IndexTemplateMetaData extends AbstractDiffable documentMapping = null; - for (ObjectObjectCursor cursor : indexTemplateMetaData.mappings()) { + for (ObjectObjectCursor cursor : indexTemplateMetadata.mappings()) { if (!cursor.key.equals(MapperService.DEFAULT_MAPPING)) { assert documentMapping == null; byte[] mappingSource = cursor.value.uncompressed(); @@ -438,7 +438,7 @@ public class IndexTemplateMetaData extends AbstractDiffable cursor : indexTemplateMetaData.mappings()) { + for (ObjectObjectCursor cursor : indexTemplateMetadata.mappings()) { byte[] mappingSource = cursor.value.uncompressed(); Map mapping = XContentHelper.convertToMap(new BytesArray(mappingSource), true).v2(); mapping = reduceMapping(cursor.key, mapping); @@ -449,7 +449,7 @@ public class IndexTemplateMetaData extends AbstractDiffable cursor : indexTemplateMetaData.mappings()) { + for (ObjectObjectCursor cursor : indexTemplateMetadata.mappings()) { byte[] data = cursor.value.uncompressed(); builder.map(XContentHelper.convertToMap(new BytesArray(data), true).v2()); } @@ -457,8 +457,8 @@ public class IndexTemplateMetaData extends AbstractDiffable cursor : indexTemplateMetaData.aliases().values()) { - AliasMetaData.Builder.toXContent(cursor.value, builder, params); + for (ObjectCursor cursor : indexTemplateMetadata.aliases().values()) { + AliasMetadata.Builder.toXContent(cursor.value, builder, params); } builder.endObject(); } @@ -473,7 +473,7 @@ public class IndexTemplateMetaData extends AbstractDiffable context() { - return MetaData.ALL_CONTEXTS; + public EnumSet context() { + return Metadata.ALL_CONTEXTS; } @Override - public Diff diff(MetaData.Custom before) { + public Diff diff(Metadata.Custom before) { return new IndexTemplateV2MetadataDiff((IndexTemplateV2Metadata) before, this); } - public static NamedDiff readDiffFrom(StreamInput in) throws IOException { + public static NamedDiff readDiffFrom(StreamInput in) throws IOException { return new IndexTemplateV2MetadataDiff(in); } @@ -138,7 +138,7 @@ public class IndexTemplateV2Metadata implements MetaData.Custom { return Strings.toString(this); } - static class IndexTemplateV2MetadataDiff implements NamedDiff { + static class IndexTemplateV2MetadataDiff implements NamedDiff { final Diff> indexTemplateDiff; @@ -153,7 +153,7 @@ public class IndexTemplateV2Metadata implements MetaData.Custom { } @Override - public MetaData.Custom apply(MetaData.Custom part) { + public Metadata.Custom apply(Metadata.Custom part) { return new IndexTemplateV2Metadata(indexTemplateDiff.apply(((IndexTemplateV2Metadata) part).indexTemplates)); } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/Manifest.java b/server/src/main/java/org/elasticsearch/cluster/metadata/Manifest.java index 746513c1d14..a18b3a28fe2 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/Manifest.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/Manifest.java @@ -26,7 +26,7 @@ import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContentFragment; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.gateway.MetaDataStateFormat; +import org.elasticsearch.gateway.MetadataStateFormat; import org.elasticsearch.index.Index; import java.io.IOException; @@ -118,7 +118,7 @@ public class Manifest implements ToXContentFragment { private static final String MANIFEST_FILE_PREFIX = "manifest-"; private static final ToXContent.Params MANIFEST_FORMAT_PARAMS = new ToXContent.MapParams(Collections.singletonMap("binary", "true")); - public static final MetaDataStateFormat FORMAT = new MetaDataStateFormat(MANIFEST_FILE_PREFIX) { + public static final MetadataStateFormat FORMAT = new MetadataStateFormat(MANIFEST_FILE_PREFIX) { @Override public void toXContent(XContentBuilder builder, Manifest state) throws IOException { diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MappingMetaData.java b/server/src/main/java/org/elasticsearch/cluster/metadata/MappingMetadata.java similarity index 93% rename from server/src/main/java/org/elasticsearch/cluster/metadata/MappingMetaData.java rename to server/src/main/java/org/elasticsearch/cluster/metadata/MappingMetadata.java index 3734b9b599a..9b945d6ca66 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MappingMetaData.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/MappingMetadata.java @@ -41,7 +41,7 @@ import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBo /** * Mapping configuration for a type. */ -public class MappingMetaData extends AbstractDiffable { +public class MappingMetadata extends AbstractDiffable { public static class Routing { @@ -79,13 +79,13 @@ public class MappingMetaData extends AbstractDiffable { private Routing routing; - public MappingMetaData(DocumentMapper docMapper) { + public MappingMetadata(DocumentMapper docMapper) { this.type = docMapper.type(); this.source = docMapper.mappingSource(); this.routing = new Routing(docMapper.routingFieldMapper().required()); } - public MappingMetaData(CompressedXContent mapping) { + public MappingMetadata(CompressedXContent mapping) { this.source = mapping; Map mappingMap = XContentHelper.convertToMap(mapping.compressedReference(), true).v2(); if (mappingMap.size() != 1) { @@ -95,7 +95,7 @@ public class MappingMetaData extends AbstractDiffable { initMappers((Map) mappingMap.get(this.type)); } - public MappingMetaData(String type, Map mapping) throws IOException { + public MappingMetadata(String type, Map mapping) throws IOException { this.type = type; XContentBuilder mappingBuilder = XContentFactory.jsonBuilder().map(mapping); this.source = new CompressedXContent(BytesReference.bytes(mappingBuilder)); @@ -128,7 +128,7 @@ public class MappingMetaData extends AbstractDiffable { } } - void updateDefaultMapping(MappingMetaData defaultMapping) { + void updateDefaultMapping(MappingMetadata defaultMapping) { if (routing == Routing.EMPTY) { routing = defaultMapping.routing(); } @@ -188,7 +188,7 @@ public class MappingMetaData extends AbstractDiffable { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - MappingMetaData that = (MappingMetaData) o; + MappingMetadata that = (MappingMetadata) o; if (!routing.equals(that.routing)) return false; if (!source.equals(that.source)) return false; @@ -205,7 +205,7 @@ public class MappingMetaData extends AbstractDiffable { return result; } - public MappingMetaData(StreamInput in) throws IOException { + public MappingMetadata(StreamInput in) throws IOException { type = in.readString(); source = CompressedXContent.readCompressedString(in); // routing @@ -225,7 +225,7 @@ public class MappingMetaData extends AbstractDiffable { } } - public static Diff readDiffFrom(StreamInput in) throws IOException { - return readDiffFrom(MappingMetaData::new, in); + public static Diff readDiffFrom(StreamInput in) throws IOException { + return readDiffFrom(MappingMetadata::new, in); } } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java b/server/src/main/java/org/elasticsearch/cluster/metadata/Metadata.java similarity index 82% rename from server/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java rename to server/src/main/java/org/elasticsearch/cluster/metadata/Metadata.java index 81ccf2bb6c7..0819049b4c6 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/Metadata.java @@ -37,7 +37,7 @@ import org.elasticsearch.cluster.NamedDiffable; import org.elasticsearch.cluster.NamedDiffableValueSerializer; import org.elasticsearch.cluster.block.ClusterBlock; import org.elasticsearch.cluster.block.ClusterBlockLevel; -import org.elasticsearch.cluster.coordination.CoordinationMetaData; +import org.elasticsearch.cluster.coordination.CoordinationMetadata; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Strings; import org.elasticsearch.common.UUIDs; @@ -55,7 +55,7 @@ import org.elasticsearch.common.xcontent.ToXContentFragment; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.gateway.MetaDataStateFormat; +import org.elasticsearch.gateway.MetadataStateFormat; import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.plugins.MapperPlugin; @@ -84,9 +84,9 @@ import java.util.stream.StreamSupport; import static org.elasticsearch.common.settings.Settings.readSettingsFromStream; import static org.elasticsearch.common.settings.Settings.writeSettingsToStream; -public class MetaData implements Iterable, Diffable, ToXContentFragment { +public class Metadata implements Iterable, Diffable, ToXContentFragment { - private static final Logger logger = LogManager.getLogger(MetaData.class); + private static final Logger logger = LogManager.getLogger(Metadata.class); public static final String ALL = "_all"; public static final String UNKNOWN_CLUSTER_UUID = "_na_"; @@ -148,7 +148,7 @@ public class MetaData implements Iterable, Diffable, To false, false, true, RestStatus.FORBIDDEN, EnumSet.of(ClusterBlockLevel.WRITE, ClusterBlockLevel.METADATA_WRITE)); - public static final MetaData EMPTY_META_DATA = builder().build(); + public static final Metadata EMPTY_META_DATA = builder().build(); public static final String CONTEXT_MODE_PARAM = "context_mode"; @@ -166,14 +166,14 @@ public class MetaData implements Iterable, Diffable, To private final boolean clusterUUIDCommitted; private final long version; - private final CoordinationMetaData coordinationMetaData; + private final CoordinationMetadata coordinationMetadata; private final Settings transientSettings; private final Settings persistentSettings; private final Settings settings; private final DiffableStringMap hashesOfConsistentSettings; - private final ImmutableOpenMap indices; - private final ImmutableOpenMap templates; + private final ImmutableOpenMap indices; + private final ImmutableOpenMap templates; private final ImmutableOpenMap customs; private final transient int totalNumberOfShards; // Transient ? not serializable anyway? @@ -188,16 +188,16 @@ public class MetaData implements Iterable, Diffable, To private final SortedMap indicesLookup; - MetaData(String clusterUUID, boolean clusterUUIDCommitted, long version, CoordinationMetaData coordinationMetaData, + Metadata(String clusterUUID, boolean clusterUUIDCommitted, long version, CoordinationMetadata coordinationMetadata, Settings transientSettings, Settings persistentSettings, DiffableStringMap hashesOfConsistentSettings, - ImmutableOpenMap indices, ImmutableOpenMap templates, + ImmutableOpenMap indices, ImmutableOpenMap templates, ImmutableOpenMap customs, String[] allIndices, String[] visibleIndices, String[] allOpenIndices, String[] visibleOpenIndices, String[] allClosedIndices, String[] visibleClosedIndices, SortedMap indicesLookup) { this.clusterUUID = clusterUUID; this.clusterUUIDCommitted = clusterUUIDCommitted; this.version = version; - this.coordinationMetaData = coordinationMetaData; + this.coordinationMetadata = coordinationMetadata; this.transientSettings = transientSettings; this.persistentSettings = persistentSettings; this.settings = Settings.builder().put(persistentSettings).put(transientSettings).build(); @@ -207,9 +207,9 @@ public class MetaData implements Iterable, Diffable, To this.templates = templates; int totalNumberOfShards = 0; int totalOpenIndexShards = 0; - for (ObjectCursor cursor : indices.values()) { + for (ObjectCursor cursor : indices.values()) { totalNumberOfShards += cursor.value.getTotalNumberOfShards(); - if (IndexMetaData.State.OPEN.equals(cursor.value.getState())) { + if (IndexMetadata.State.OPEN.equals(cursor.value.getState())) { totalOpenIndexShards += cursor.value.getTotalNumberOfShards(); } } @@ -260,8 +260,8 @@ public class MetaData implements Iterable, Diffable, To return this.hashesOfConsistentSettings; } - public CoordinationMetaData coordinationMetaData() { - return this.coordinationMetaData; + public CoordinationMetadata coordinationMetadata() { + return this.coordinationMetadata; } public boolean hasAlias(String alias) { @@ -273,10 +273,10 @@ public class MetaData implements Iterable, Diffable, To } } - public boolean equalsAliases(MetaData other) { - for (ObjectCursor cursor : other.indices().values()) { - IndexMetaData otherIndex = cursor.value; - IndexMetaData thisIndex = index(otherIndex.getIndex()); + public boolean equalsAliases(Metadata other) { + for (ObjectCursor cursor : other.indices().values()) { + IndexMetadata otherIndex = cursor.value; + IndexMetadata thisIndex = index(otherIndex.getIndex()); if (thisIndex == null) { return false; } @@ -300,7 +300,7 @@ public class MetaData implements Iterable, Diffable, To * @return A map of index name to the list of aliases metadata. If a concrete index does not have matching * aliases then the result will not include the index's key. */ - public ImmutableOpenMap> findAllAliases(final String[] concreteIndices) { + public ImmutableOpenMap> findAllAliases(final String[] concreteIndices) { return findAliases(Strings.EMPTY_ARRAY, concreteIndices); } @@ -313,7 +313,7 @@ public class MetaData implements Iterable, Diffable, To * @return A map of index name to the list of aliases metadata. If a concrete index does not have matching * aliases then the result will not include the index's key. */ - public ImmutableOpenMap> findAliases(final AliasesRequest aliasesRequest, final String[] concreteIndices) { + public ImmutableOpenMap> findAliases(final AliasesRequest aliasesRequest, final String[] concreteIndices) { return findAliases(aliasesRequest.aliases(), concreteIndices); } @@ -326,7 +326,7 @@ public class MetaData implements Iterable, Diffable, To * @return A map of index name to the list of aliases metadata. If a concrete index does not have matching * aliases then the result will not include the index's key. */ - private ImmutableOpenMap> findAliases(final String[] aliases, final String[] concreteIndices) { + private ImmutableOpenMap> findAliases(final String[] aliases, final String[] concreteIndices) { assert aliases != null; assert concreteIndices != null; if (concreteIndices.length == 0) { @@ -345,12 +345,12 @@ public class MetaData implements Iterable, Diffable, To } } boolean matchAllAliases = patterns.length == 0; - ImmutableOpenMap.Builder> mapBuilder = ImmutableOpenMap.builder(); + ImmutableOpenMap.Builder> mapBuilder = ImmutableOpenMap.builder(); for (String index : concreteIndices) { - IndexMetaData indexMetaData = indices.get(index); - List filteredValues = new ArrayList<>(); - for (ObjectCursor cursor : indexMetaData.getAliases().values()) { - AliasMetaData value = cursor.value; + IndexMetadata indexMetadata = indices.get(index); + List filteredValues = new ArrayList<>(); + for (ObjectCursor cursor : indexMetadata.getAliases().values()) { + AliasMetadata value = cursor.value; boolean matched = matchAllAliases; String alias = value.alias(); for (int i = 0; i < patterns.length; i++) { @@ -369,7 +369,7 @@ public class MetaData implements Iterable, Diffable, To } if (filteredValues.isEmpty() == false) { // Make the list order deterministic - CollectionUtil.timSort(filteredValues, Comparator.comparing(AliasMetaData::alias)); + CollectionUtil.timSort(filteredValues, Comparator.comparing(AliasMetadata::alias)); mapBuilder.put(index, Collections.unmodifiableList(filteredValues)); } } @@ -393,10 +393,10 @@ public class MetaData implements Iterable, Diffable, To Iterable intersection = HppcMaps.intersection(ObjectHashSet.from(concreteIndices), indices.keys()); for (String index : intersection) { - IndexMetaData indexMetaData = indices.get(index); - List filteredValues = new ArrayList<>(); - for (ObjectCursor cursor : indexMetaData.getAliases().values()) { - AliasMetaData value = cursor.value; + IndexMetadata indexMetadata = indices.get(index); + List filteredValues = new ArrayList<>(); + for (ObjectCursor cursor : indexMetadata.getAliases().values()) { + AliasMetadata value = cursor.value; if (Regex.simpleMatch(aliases, value.alias())) { filteredValues.add(value); } @@ -417,7 +417,7 @@ public class MetaData implements Iterable, Diffable, To * @see MapperPlugin#getFieldFilter() * */ - public ImmutableOpenMap> findMappings(String[] concreteIndices, + public ImmutableOpenMap> findMappings(String[] concreteIndices, final String[] types, Function> fieldFilter) throws IOException { @@ -428,16 +428,16 @@ public class MetaData implements Iterable, Diffable, To } boolean isAllTypes = isAllTypes(types); - ImmutableOpenMap.Builder> indexMapBuilder = ImmutableOpenMap.builder(); + ImmutableOpenMap.Builder> indexMapBuilder = ImmutableOpenMap.builder(); Iterable intersection = HppcMaps.intersection(ObjectHashSet.from(concreteIndices), indices.keys()); for (String index : intersection) { - IndexMetaData indexMetaData = indices.get(index); + IndexMetadata indexMetadata = indices.get(index); Predicate fieldPredicate = fieldFilter.apply(index); if (isAllTypes) { - indexMapBuilder.put(index, filterFields(indexMetaData.getMappings(), fieldPredicate)); + indexMapBuilder.put(index, filterFields(indexMetadata.getMappings(), fieldPredicate)); } else { - ImmutableOpenMap.Builder filteredMappings = ImmutableOpenMap.builder(); - for (ObjectObjectCursor cursor : indexMetaData.getMappings()) { + ImmutableOpenMap.Builder filteredMappings = ImmutableOpenMap.builder(); + for (ObjectObjectCursor cursor : indexMetadata.getMappings()) { if (Regex.simpleMatch(types, cursor.key)) { filteredMappings.put(cursor.key, filterFields(cursor.value, fieldPredicate)); } @@ -450,39 +450,39 @@ public class MetaData implements Iterable, Diffable, To return indexMapBuilder.build(); } - private static ImmutableOpenMap filterFields(ImmutableOpenMap mappings, + private static ImmutableOpenMap filterFields(ImmutableOpenMap mappings, Predicate fieldPredicate) throws IOException { if (fieldPredicate == MapperPlugin.NOOP_FIELD_PREDICATE) { return mappings; } - ImmutableOpenMap.Builder builder = ImmutableOpenMap.builder(mappings.size()); - for (ObjectObjectCursor cursor : mappings) { + ImmutableOpenMap.Builder builder = ImmutableOpenMap.builder(mappings.size()); + for (ObjectObjectCursor cursor : mappings) { builder.put(cursor.key, filterFields(cursor.value, fieldPredicate)); } return builder.build(); // No types specified means return them all } @SuppressWarnings("unchecked") - private static MappingMetaData filterFields(MappingMetaData mappingMetaData, Predicate fieldPredicate) throws IOException { + private static MappingMetadata filterFields(MappingMetadata mappingMetadata, Predicate fieldPredicate) throws IOException { if (fieldPredicate == MapperPlugin.NOOP_FIELD_PREDICATE) { - return mappingMetaData; + return mappingMetadata; } - Map sourceAsMap = XContentHelper.convertToMap(mappingMetaData.source().compressedReference(), true).v2(); + Map sourceAsMap = XContentHelper.convertToMap(mappingMetadata.source().compressedReference(), true).v2(); Map mapping; - if (sourceAsMap.size() == 1 && sourceAsMap.containsKey(mappingMetaData.type())) { - mapping = (Map) sourceAsMap.get(mappingMetaData.type()); + if (sourceAsMap.size() == 1 && sourceAsMap.containsKey(mappingMetadata.type())) { + mapping = (Map) sourceAsMap.get(mappingMetadata.type()); } else { mapping = sourceAsMap; } Map properties = (Map)mapping.get("properties"); if (properties == null || properties.isEmpty()) { - return mappingMetaData; + return mappingMetadata; } filterFields("", properties, fieldPredicate); - return new MappingMetaData(mappingMetaData.type(), sourceAsMap); + return new MappingMetadata(mappingMetadata.type(), sourceAsMap); } @SuppressWarnings("unchecked") @@ -594,11 +594,11 @@ public class MetaData implements Iterable, Diffable, To if (result == null || result.getType() != IndexAbstraction.Type.ALIAS) { return routing; } - IndexMetaData writeIndex = result.getWriteIndex(); + IndexMetadata writeIndex = result.getWriteIndex(); if (writeIndex == null) { throw new IllegalArgumentException("alias [" + aliasOrIndex + "] does not have a write index"); } - AliasMetaData aliasMd = writeIndex.getAliases().get(result.getName()); + AliasMetadata aliasMd = writeIndex.getAliases().get(result.getName()); if (aliasMd.indexRouting() != null) { if (aliasMd.indexRouting().indexOf(',') != -1) { throw new IllegalArgumentException("index/alias [" + aliasOrIndex + "] provided with routing value [" @@ -634,7 +634,7 @@ public class MetaData implements Iterable, Diffable, To if (result.getIndices().size() > 1) { rejectSingleIndexOperation(aliasOrIndex, result); } - AliasMetaData aliasMd = alias.getFirstAliasMetaData(); + AliasMetadata aliasMd = alias.getFirstAliasMetadata(); if (aliasMd.indexRouting() != null) { if (aliasMd.indexRouting().indexOf(',') != -1) { throw new IllegalArgumentException("index/alias [" + aliasOrIndex + "] provided with routing value [" + @@ -655,8 +655,8 @@ public class MetaData implements Iterable, Diffable, To private void rejectSingleIndexOperation(String aliasOrIndex, IndexAbstraction result) { String[] indexNames = new String[result.getIndices().size()]; int i = 0; - for (IndexMetaData indexMetaData : result.getIndices()) { - indexNames[i++] = indexMetaData.getIndex().getName(); + for (IndexMetadata indexMetadata : result.getIndices()) { + indexNames[i++] = indexMetadata.getIndex().getName(); } throw new IllegalArgumentException("Alias [" + aliasOrIndex + "] has more than one index associated with it [" + Arrays.toString(indexNames) + "], can't execute a single index op"); @@ -670,53 +670,53 @@ public class MetaData implements Iterable, Diffable, To return getIndicesLookup().containsKey(index); } - public IndexMetaData index(String index) { + public IndexMetadata index(String index) { return indices.get(index); } - public IndexMetaData index(Index index) { - IndexMetaData metaData = index(index.getName()); - if (metaData != null && metaData.getIndexUUID().equals(index.getUUID())) { - return metaData; + public IndexMetadata index(Index index) { + IndexMetadata metadata = index(index.getName()); + if (metadata != null && metadata.getIndexUUID().equals(index.getUUID())) { + return metadata; } return null; } - /** Returns true iff existing index has the same {@link IndexMetaData} instance */ - public boolean hasIndexMetaData(final IndexMetaData indexMetaData) { - return indices.get(indexMetaData.getIndex().getName()) == indexMetaData; + /** Returns true iff existing index has the same {@link IndexMetadata} instance */ + public boolean hasIndexMetadata(final IndexMetadata indexMetadata) { + return indices.get(indexMetadata.getIndex().getName()) == indexMetadata; } /** - * Returns the {@link IndexMetaData} for this index. + * Returns the {@link IndexMetadata} for this index. * @throws IndexNotFoundException if no metadata for this index is found */ - public IndexMetaData getIndexSafe(Index index) { - IndexMetaData metaData = index(index.getName()); - if (metaData != null) { - if(metaData.getIndexUUID().equals(index.getUUID())) { - return metaData; + public IndexMetadata getIndexSafe(Index index) { + IndexMetadata metadata = index(index.getName()); + if (metadata != null) { + if(metadata.getIndexUUID().equals(index.getUUID())) { + return metadata; } throw new IndexNotFoundException(index, new IllegalStateException("index uuid doesn't match expected: [" + index.getUUID() - + "] but got: [" + metaData.getIndexUUID() +"]")); + + "] but got: [" + metadata.getIndexUUID() +"]")); } throw new IndexNotFoundException(index); } - public ImmutableOpenMap indices() { + public ImmutableOpenMap indices() { return this.indices; } - public ImmutableOpenMap getIndices() { + public ImmutableOpenMap getIndices() { return indices(); } - public ImmutableOpenMap templates() { + public ImmutableOpenMap templates() { return this.templates; } - public ImmutableOpenMap getTemplates() { + public ImmutableOpenMap getTemplates() { return this.templates; } @@ -803,50 +803,50 @@ public class MetaData implements Iterable, Diffable, To * @return Whether routing is required according to the mapping for the specified index and type */ public boolean routingRequired(String concreteIndex) { - IndexMetaData indexMetaData = indices.get(concreteIndex); - if (indexMetaData != null) { - MappingMetaData mappingMetaData = indexMetaData.mapping(); - if (mappingMetaData != null) { - return mappingMetaData.routing().required(); + IndexMetadata indexMetadata = indices.get(concreteIndex); + if (indexMetadata != null) { + MappingMetadata mappingMetadata = indexMetadata.mapping(); + if (mappingMetadata != null) { + return mappingMetadata.routing().required(); } } return false; } @Override - public Iterator iterator() { + public Iterator iterator() { return indices.valuesIt(); } - public static boolean isGlobalStateEquals(MetaData metaData1, MetaData metaData2) { - if (!metaData1.coordinationMetaData.equals(metaData2.coordinationMetaData)) { + public static boolean isGlobalStateEquals(Metadata metadata1, Metadata metadata2) { + if (!metadata1.coordinationMetadata.equals(metadata2.coordinationMetadata)) { return false; } - if (!metaData1.persistentSettings.equals(metaData2.persistentSettings)) { + if (!metadata1.persistentSettings.equals(metadata2.persistentSettings)) { return false; } - if (!metaData1.hashesOfConsistentSettings.equals(metaData2.hashesOfConsistentSettings)) { + if (!metadata1.hashesOfConsistentSettings.equals(metadata2.hashesOfConsistentSettings)) { return false; } - if (!metaData1.templates.equals(metaData2.templates())) { + if (!metadata1.templates.equals(metadata2.templates())) { return false; } - if (!metaData1.clusterUUID.equals(metaData2.clusterUUID)) { + if (!metadata1.clusterUUID.equals(metadata2.clusterUUID)) { return false; } - if (metaData1.clusterUUIDCommitted != metaData2.clusterUUIDCommitted) { + if (metadata1.clusterUUIDCommitted != metadata2.clusterUUIDCommitted) { return false; } // Check if any persistent metadata needs to be saved int customCount1 = 0; - for (ObjectObjectCursor cursor : metaData1.customs) { + for (ObjectObjectCursor cursor : metadata1.customs) { if (cursor.value.context().contains(XContentContext.GATEWAY)) { - if (!cursor.value.equals(metaData2.custom(cursor.key))) return false; + if (!cursor.value.equals(metadata2.custom(cursor.key))) return false; customCount1++; } } int customCount2 = 0; - for (ObjectCursor cursor : metaData2.customs.values()) { + for (ObjectCursor cursor : metadata2.customs.values()) { if (cursor.value.context().contains(XContentContext.GATEWAY)) { customCount2++; } @@ -856,15 +856,15 @@ public class MetaData implements Iterable, Diffable, To } @Override - public Diff diff(MetaData previousState) { - return new MetaDataDiff(previousState, this); + public Diff diff(Metadata previousState) { + return new MetadataDiff(previousState, this); } - public static Diff readDiffFrom(StreamInput in) throws IOException { - return new MetaDataDiff(in); + public static Diff readDiffFrom(StreamInput in) throws IOException { + return new MetadataDiff(in); } - public static MetaData fromXContent(XContentParser parser) throws IOException { + public static Metadata fromXContent(XContentParser parser) throws IOException { return Builder.fromXContent(parser); } @@ -874,24 +874,24 @@ public class MetaData implements Iterable, Diffable, To return builder; } - private static class MetaDataDiff implements Diff { + private static class MetadataDiff implements Diff { private long version; private String clusterUUID; private boolean clusterUUIDCommitted; - private CoordinationMetaData coordinationMetaData; + private CoordinationMetadata coordinationMetadata; private Settings transientSettings; private Settings persistentSettings; private Diff hashesOfConsistentSettings; - private Diff> indices; - private Diff> templates; + private Diff> indices; + private Diff> templates; private Diff> customs; - MetaDataDiff(MetaData before, MetaData after) { + MetadataDiff(Metadata before, Metadata after) { clusterUUID = after.clusterUUID; clusterUUIDCommitted = after.clusterUUIDCommitted; version = after.version; - coordinationMetaData = after.coordinationMetaData; + coordinationMetadata = after.coordinationMetadata; transientSettings = after.transientSettings; persistentSettings = after.persistentSettings; hashesOfConsistentSettings = after.hashesOfConsistentSettings.diff(before.hashesOfConsistentSettings); @@ -900,16 +900,16 @@ public class MetaData implements Iterable, Diffable, To customs = DiffableUtils.diff(before.customs, after.customs, DiffableUtils.getStringKeySerializer(), CUSTOM_VALUE_SERIALIZER); } - MetaDataDiff(StreamInput in) throws IOException { + MetadataDiff(StreamInput in) throws IOException { clusterUUID = in.readString(); if (in.getVersion().onOrAfter(Version.V_7_0_0)) { clusterUUIDCommitted = in.readBoolean(); } version = in.readLong(); if (in.getVersion().onOrAfter(Version.V_7_0_0)) { - coordinationMetaData = new CoordinationMetaData(in); + coordinationMetadata = new CoordinationMetadata(in); } else { - coordinationMetaData = CoordinationMetaData.EMPTY_META_DATA; + coordinationMetadata = CoordinationMetadata.EMPTY_META_DATA; } transientSettings = Settings.readSettingsFromStream(in); persistentSettings = Settings.readSettingsFromStream(in); @@ -918,10 +918,10 @@ public class MetaData implements Iterable, Diffable, To } else { hashesOfConsistentSettings = DiffableStringMap.DiffableStringMapDiff.EMPTY; } - indices = DiffableUtils.readImmutableOpenMapDiff(in, DiffableUtils.getStringKeySerializer(), IndexMetaData::readFrom, - IndexMetaData::readDiffFrom); - templates = DiffableUtils.readImmutableOpenMapDiff(in, DiffableUtils.getStringKeySerializer(), IndexTemplateMetaData::readFrom, - IndexTemplateMetaData::readDiffFrom); + indices = DiffableUtils.readImmutableOpenMapDiff(in, DiffableUtils.getStringKeySerializer(), IndexMetadata::readFrom, + IndexMetadata::readDiffFrom); + templates = DiffableUtils.readImmutableOpenMapDiff(in, DiffableUtils.getStringKeySerializer(), IndexTemplateMetadata::readFrom, + IndexTemplateMetadata::readDiffFrom); customs = DiffableUtils.readImmutableOpenMapDiff(in, DiffableUtils.getStringKeySerializer(), CUSTOM_VALUE_SERIALIZER); } @@ -933,7 +933,7 @@ public class MetaData implements Iterable, Diffable, To } out.writeLong(version); if (out.getVersion().onOrAfter(Version.V_7_0_0)) { - coordinationMetaData.writeTo(out); + coordinationMetadata.writeTo(out); } Settings.writeSettingsToStream(transientSettings, out); Settings.writeSettingsToStream(persistentSettings, out); @@ -946,12 +946,12 @@ public class MetaData implements Iterable, Diffable, To } @Override - public MetaData apply(MetaData part) { + public Metadata apply(Metadata part) { Builder builder = builder(); builder.clusterUUID(clusterUUID); builder.clusterUUIDCommitted(clusterUUIDCommitted); builder.version(version); - builder.coordinationMetaData(coordinationMetaData); + builder.coordinationMetadata(coordinationMetadata); builder.transientSettings(transientSettings); builder.persistentSettings(persistentSettings); builder.hashesOfConsistentSettings(hashesOfConsistentSettings.apply(part.hashesOfConsistentSettings)); @@ -962,7 +962,7 @@ public class MetaData implements Iterable, Diffable, To } } - public static MetaData readFrom(StreamInput in) throws IOException { + public static Metadata readFrom(StreamInput in) throws IOException { Builder builder = new Builder(); builder.version = in.readLong(); builder.clusterUUID = in.readString(); @@ -970,7 +970,7 @@ public class MetaData implements Iterable, Diffable, To builder.clusterUUIDCommitted = in.readBoolean(); } if (in.getVersion().onOrAfter(Version.V_7_0_0)) { - builder.coordinationMetaData(new CoordinationMetaData(in)); + builder.coordinationMetadata(new CoordinationMetadata(in)); } builder.transientSettings(readSettingsFromStream(in)); builder.persistentSettings(readSettingsFromStream(in)); @@ -979,16 +979,16 @@ public class MetaData implements Iterable, Diffable, To } int size = in.readVInt(); for (int i = 0; i < size; i++) { - builder.put(IndexMetaData.readFrom(in), false); + builder.put(IndexMetadata.readFrom(in), false); } size = in.readVInt(); for (int i = 0; i < size; i++) { - builder.put(IndexTemplateMetaData.readFrom(in)); + builder.put(IndexTemplateMetadata.readFrom(in)); } int customSize = in.readVInt(); for (int i = 0; i < customSize; i++) { - Custom customIndexMetaData = in.readNamedWriteable(Custom.class); - builder.putCustom(customIndexMetaData.getWriteableName(), customIndexMetaData); + Custom customIndexMetadata = in.readNamedWriteable(Custom.class); + builder.putCustom(customIndexMetadata.getWriteableName(), customIndexMetadata); } return builder.build(); } @@ -1001,7 +1001,7 @@ public class MetaData implements Iterable, Diffable, To out.writeBoolean(clusterUUIDCommitted); } if (out.getVersion().onOrAfter(Version.V_7_0_0)) { - coordinationMetaData.writeTo(out); + coordinationMetadata.writeTo(out); } writeSettingsToStream(transientSettings, out); writeSettingsToStream(persistentSettings, out); @@ -1009,11 +1009,11 @@ public class MetaData implements Iterable, Diffable, To hashesOfConsistentSettings.writeTo(out); } out.writeVInt(indices.size()); - for (IndexMetaData indexMetaData : this) { - indexMetaData.writeTo(out); + for (IndexMetadata indexMetadata : this) { + indexMetadata.writeTo(out); } out.writeVInt(templates.size()); - for (ObjectCursor cursor : templates.values()) { + for (ObjectCursor cursor : templates.values()) { cursor.value.writeTo(out); } // filter out custom states not supported by the other node @@ -1035,8 +1035,8 @@ public class MetaData implements Iterable, Diffable, To return new Builder(); } - public static Builder builder(MetaData metaData) { - return new Builder(metaData); + public static Builder builder(Metadata metadata) { + return new Builder(metadata); } public static class Builder { @@ -1045,13 +1045,13 @@ public class MetaData implements Iterable, Diffable, To private boolean clusterUUIDCommitted; private long version; - private CoordinationMetaData coordinationMetaData = CoordinationMetaData.EMPTY_META_DATA; + private CoordinationMetadata coordinationMetadata = CoordinationMetadata.EMPTY_META_DATA; private Settings transientSettings = Settings.Builder.EMPTY_SETTINGS; private Settings persistentSettings = Settings.Builder.EMPTY_SETTINGS; private DiffableStringMap hashesOfConsistentSettings = new DiffableStringMap(Collections.emptyMap()); - private final ImmutableOpenMap.Builder indices; - private final ImmutableOpenMap.Builder templates; + private final ImmutableOpenMap.Builder indices; + private final ImmutableOpenMap.Builder templates; private final ImmutableOpenMap.Builder customs; public Builder() { @@ -1062,52 +1062,52 @@ public class MetaData implements Iterable, Diffable, To indexGraveyard(IndexGraveyard.builder().build()); // create new empty index graveyard to initialize } - public Builder(MetaData metaData) { - this.clusterUUID = metaData.clusterUUID; - this.clusterUUIDCommitted = metaData.clusterUUIDCommitted; - this.coordinationMetaData = metaData.coordinationMetaData; - this.transientSettings = metaData.transientSettings; - this.persistentSettings = metaData.persistentSettings; - this.hashesOfConsistentSettings = metaData.hashesOfConsistentSettings; - this.version = metaData.version; - this.indices = ImmutableOpenMap.builder(metaData.indices); - this.templates = ImmutableOpenMap.builder(metaData.templates); - this.customs = ImmutableOpenMap.builder(metaData.customs); + public Builder(Metadata metadata) { + this.clusterUUID = metadata.clusterUUID; + this.clusterUUIDCommitted = metadata.clusterUUIDCommitted; + this.coordinationMetadata = metadata.coordinationMetadata; + this.transientSettings = metadata.transientSettings; + this.persistentSettings = metadata.persistentSettings; + this.hashesOfConsistentSettings = metadata.hashesOfConsistentSettings; + this.version = metadata.version; + this.indices = ImmutableOpenMap.builder(metadata.indices); + this.templates = ImmutableOpenMap.builder(metadata.templates); + this.customs = ImmutableOpenMap.builder(metadata.customs); } - public Builder put(IndexMetaData.Builder indexMetaDataBuilder) { + public Builder put(IndexMetadata.Builder indexMetadataBuilder) { // we know its a new one, increment the version and store - indexMetaDataBuilder.version(indexMetaDataBuilder.version() + 1); - IndexMetaData indexMetaData = indexMetaDataBuilder.build(); - indices.put(indexMetaData.getIndex().getName(), indexMetaData); + indexMetadataBuilder.version(indexMetadataBuilder.version() + 1); + IndexMetadata indexMetadata = indexMetadataBuilder.build(); + indices.put(indexMetadata.getIndex().getName(), indexMetadata); return this; } - public Builder put(IndexMetaData indexMetaData, boolean incrementVersion) { - if (indices.get(indexMetaData.getIndex().getName()) == indexMetaData) { + public Builder put(IndexMetadata indexMetadata, boolean incrementVersion) { + if (indices.get(indexMetadata.getIndex().getName()) == indexMetadata) { return this; } // if we put a new index metadata, increment its version if (incrementVersion) { - indexMetaData = IndexMetaData.builder(indexMetaData).version(indexMetaData.getVersion() + 1).build(); + indexMetadata = IndexMetadata.builder(indexMetadata).version(indexMetadata.getVersion() + 1).build(); } - indices.put(indexMetaData.getIndex().getName(), indexMetaData); + indices.put(indexMetadata.getIndex().getName(), indexMetadata); return this; } - public IndexMetaData get(String index) { + public IndexMetadata get(String index) { return indices.get(index); } - public IndexMetaData getSafe(Index index) { - IndexMetaData indexMetaData = get(index.getName()); - if (indexMetaData != null) { - if(indexMetaData.getIndexUUID().equals(index.getUUID())) { - return indexMetaData; + public IndexMetadata getSafe(Index index) { + IndexMetadata indexMetadata = get(index.getName()); + if (indexMetadata != null) { + if(indexMetadata.getIndexUUID().equals(index.getUUID())) { + return indexMetadata; } throw new IndexNotFoundException(index, new IllegalStateException("index uuid doesn't match expected: [" + index.getUUID() - + "] but got: [" + indexMetaData.getIndexUUID() +"]")); + + "] but got: [" + indexMetadata.getIndexUUID() +"]")); } throw new IndexNotFoundException(index); } @@ -1122,16 +1122,16 @@ public class MetaData implements Iterable, Diffable, To return this; } - public Builder indices(ImmutableOpenMap indices) { + public Builder indices(ImmutableOpenMap indices) { this.indices.putAll(indices); return this; } - public Builder put(IndexTemplateMetaData.Builder template) { + public Builder put(IndexTemplateMetadata.Builder template) { return put(template.build()); } - public Builder put(IndexTemplateMetaData template) { + public Builder put(IndexTemplateMetadata template) { templates.put(template.name(), template); return this; } @@ -1141,7 +1141,7 @@ public class MetaData implements Iterable, Diffable, To return this; } - public Builder templates(ImmutableOpenMap templates) { + public Builder templates(ImmutableOpenMap templates) { this.templates.putAll(templates); return this; } @@ -1263,12 +1263,12 @@ public class MetaData implements Iterable, Diffable, To indices = this.indices.keys().toArray(String.class); } for (String index : indices) { - IndexMetaData indexMetaData = this.indices.get(index); - if (indexMetaData == null) { + IndexMetadata indexMetadata = this.indices.get(index); + if (indexMetadata == null) { throw new IndexNotFoundException(index); } - put(IndexMetaData.builder(indexMetaData) - .settings(Settings.builder().put(indexMetaData.getSettings()).put(settings))); + put(IndexMetadata.builder(indexMetadata) + .settings(Settings.builder().put(indexMetadata.getSettings()).put(settings))); } return this; } @@ -1282,17 +1282,17 @@ public class MetaData implements Iterable, Diffable, To */ public Builder updateNumberOfReplicas(final int numberOfReplicas, final String[] indices) { for (String index : indices) { - IndexMetaData indexMetaData = this.indices.get(index); - if (indexMetaData == null) { + IndexMetadata indexMetadata = this.indices.get(index); + if (indexMetadata == null) { throw new IndexNotFoundException(index); } - put(IndexMetaData.builder(indexMetaData).numberOfReplicas(numberOfReplicas)); + put(IndexMetadata.builder(indexMetadata).numberOfReplicas(numberOfReplicas)); } return this; } - public Builder coordinationMetaData(CoordinationMetaData coordinationMetaData) { - this.coordinationMetaData = coordinationMetaData; + public Builder coordinationMetadata(CoordinationMetadata coordinationMetadata) { + this.coordinationMetadata = coordinationMetadata; return this; } @@ -1350,7 +1350,7 @@ public class MetaData implements Iterable, Diffable, To return this; } - public MetaData build() { + public Metadata build() { // TODO: We should move these datastructures to IndexNameExpressionResolver, this will give the following benefits: // 1) The datastructures will be rebuilt only when needed. Now during serializing we rebuild these datastructures // while these datastructures aren't even used. @@ -1363,33 +1363,33 @@ public class MetaData implements Iterable, Diffable, To final List allClosedIndices = new ArrayList<>(); final List visibleClosedIndices = new ArrayList<>(); final Set duplicateAliasesIndices = new HashSet<>(); - for (ObjectCursor cursor : indices.values()) { - final IndexMetaData indexMetaData = cursor.value; - final String name = indexMetaData.getIndex().getName(); + for (ObjectCursor cursor : indices.values()) { + final IndexMetadata indexMetadata = cursor.value; + final String name = indexMetadata.getIndex().getName(); boolean added = allIndices.add(name); assert added : "double index named [" + name + "]"; - final boolean visible = IndexMetaData.INDEX_HIDDEN_SETTING.get(indexMetaData.getSettings()) == false; + final boolean visible = IndexMetadata.INDEX_HIDDEN_SETTING.get(indexMetadata.getSettings()) == false; if (visible) { visibleIndices.add(name); } - if (indexMetaData.getState() == IndexMetaData.State.OPEN) { + if (indexMetadata.getState() == IndexMetadata.State.OPEN) { allOpenIndices.add(name); if (visible) { visibleOpenIndices.add(name); } - } else if (indexMetaData.getState() == IndexMetaData.State.CLOSE) { + } else if (indexMetadata.getState() == IndexMetadata.State.CLOSE) { allClosedIndices.add(name); if (visible) { visibleClosedIndices.add(name); } } - indexMetaData.getAliases().keysIt().forEachRemaining(duplicateAliasesIndices::add); + indexMetadata.getAliases().keysIt().forEachRemaining(duplicateAliasesIndices::add); } duplicateAliasesIndices.retainAll(allIndices); if (duplicateAliasesIndices.isEmpty() == false) { // iterate again and constructs a helpful message ArrayList duplicates = new ArrayList<>(); - for (ObjectCursor cursor : indices.values()) { + for (ObjectCursor cursor : indices.values()) { for (String alias : duplicateAliasesIndices) { if (cursor.value.getAliases().containsKey(alias)) { duplicates.add(alias + " (alias of " + cursor.value.getIndex() + ")"); @@ -1417,27 +1417,27 @@ public class MetaData implements Iterable, Diffable, To String[] allClosedIndicesArray = allClosedIndices.toArray(Strings.EMPTY_ARRAY); String[] visibleClosedIndicesArray = visibleClosedIndices.toArray(Strings.EMPTY_ARRAY); - return new MetaData(clusterUUID, clusterUUIDCommitted, version, coordinationMetaData, transientSettings, persistentSettings, + return new Metadata(clusterUUID, clusterUUIDCommitted, version, coordinationMetadata, transientSettings, persistentSettings, hashesOfConsistentSettings, indices.build(), templates.build(), customs.build(), allIndicesArray, visibleIndicesArray, allOpenIndicesArray, visibleOpenIndicesArray, allClosedIndicesArray, visibleClosedIndicesArray, indicesLookup); } private SortedMap buildIndicesLookup() { SortedMap aliasAndIndexLookup = new TreeMap<>(); - for (ObjectCursor cursor : indices.values()) { - IndexMetaData indexMetaData = cursor.value; + for (ObjectCursor cursor : indices.values()) { + IndexMetadata indexMetadata = cursor.value; IndexAbstraction existing = - aliasAndIndexLookup.put(indexMetaData.getIndex().getName(), new IndexAbstraction.Index(indexMetaData)); - assert existing == null : "duplicate for " + indexMetaData.getIndex(); + aliasAndIndexLookup.put(indexMetadata.getIndex().getName(), new IndexAbstraction.Index(indexMetadata)); + assert existing == null : "duplicate for " + indexMetadata.getIndex(); - for (ObjectObjectCursor aliasCursor : indexMetaData.getAliases()) { - AliasMetaData aliasMetaData = aliasCursor.value; - aliasAndIndexLookup.compute(aliasMetaData.getAlias(), (aliasName, alias) -> { + for (ObjectObjectCursor aliasCursor : indexMetadata.getAliases()) { + AliasMetadata aliasMetadata = aliasCursor.value; + aliasAndIndexLookup.compute(aliasMetadata.getAlias(), (aliasName, alias) -> { if (alias == null) { - return new IndexAbstraction.Alias(aliasMetaData, indexMetaData); + return new IndexAbstraction.Alias(aliasMetadata, indexMetadata); } else { assert alias.getType() == IndexAbstraction.Type.ALIAS : alias.getClass().getName(); - ((IndexAbstraction.Alias) alias).addIndex(indexMetaData); + ((IndexAbstraction.Alias) alias).addIndex(indexMetadata); return alias; } }); @@ -1467,44 +1467,44 @@ public class MetaData implements Iterable, Diffable, To } } - public static void toXContent(MetaData metaData, XContentBuilder builder, ToXContent.Params params) throws IOException { + public static void toXContent(Metadata metadata, XContentBuilder builder, ToXContent.Params params) throws IOException { XContentContext context = XContentContext.valueOf(params.param(CONTEXT_MODE_PARAM, CONTEXT_MODE_API)); if (context == XContentContext.API) { builder.startObject("metadata"); } else { builder.startObject("meta-data"); - builder.field("version", metaData.version()); + builder.field("version", metadata.version()); } - builder.field("cluster_uuid", metaData.clusterUUID); - builder.field("cluster_uuid_committed", metaData.clusterUUIDCommitted); + builder.field("cluster_uuid", metadata.clusterUUID); + builder.field("cluster_uuid_committed", metadata.clusterUUIDCommitted); builder.startObject("cluster_coordination"); - metaData.coordinationMetaData().toXContent(builder, params); + metadata.coordinationMetadata().toXContent(builder, params); builder.endObject(); - if (context != XContentContext.API && !metaData.persistentSettings().isEmpty()) { + if (context != XContentContext.API && !metadata.persistentSettings().isEmpty()) { builder.startObject("settings"); - metaData.persistentSettings().toXContent(builder, new MapParams(Collections.singletonMap("flat_settings", "true"))); + metadata.persistentSettings().toXContent(builder, new MapParams(Collections.singletonMap("flat_settings", "true"))); builder.endObject(); } builder.startObject("templates"); - for (ObjectCursor cursor : metaData.templates().values()) { - IndexTemplateMetaData.Builder.toXContentWithTypes(cursor.value, builder, params); + for (ObjectCursor cursor : metadata.templates().values()) { + IndexTemplateMetadata.Builder.toXContentWithTypes(cursor.value, builder, params); } builder.endObject(); if (context == XContentContext.API) { builder.startObject("indices"); - for (IndexMetaData indexMetaData : metaData) { - IndexMetaData.Builder.toXContent(indexMetaData, builder, params); + for (IndexMetadata indexMetadata : metadata) { + IndexMetadata.Builder.toXContent(indexMetadata, builder, params); } builder.endObject(); } - for (ObjectObjectCursor cursor : metaData.customs()) { + for (ObjectObjectCursor cursor : metadata.customs()) { if (cursor.value.context().contains(context)) { builder.startObject(cursor.key); cursor.value.toXContent(builder, params); @@ -1514,7 +1514,7 @@ public class MetaData implements Iterable, Diffable, To builder.endObject(); } - public static MetaData fromXContent(XContentParser parser) throws IOException { + public static Metadata fromXContent(XContentParser parser) throws IOException { Builder builder = new Builder(); // we might get here after the meta-data element, or on a fresh parser @@ -1546,18 +1546,18 @@ public class MetaData implements Iterable, Diffable, To currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.START_OBJECT) { if ("cluster_coordination".equals(currentFieldName)) { - builder.coordinationMetaData(CoordinationMetaData.fromXContent(parser)); + builder.coordinationMetadata(CoordinationMetadata.fromXContent(parser)); } else if ("settings".equals(currentFieldName)) { builder.persistentSettings(Settings.fromXContent(parser)); } else if ("indices".equals(currentFieldName)) { while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { - builder.put(IndexMetaData.Builder.fromXContent(parser), false); + builder.put(IndexMetadata.Builder.fromXContent(parser), false); } } else if ("hashes_of_consistent_settings".equals(currentFieldName)) { builder.hashesOfConsistentSettings(parser.mapStrings()); } else if ("templates".equals(currentFieldName)) { while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { - builder.put(IndexTemplateMetaData.Builder.fromXContent(parser, parser.currentName())); + builder.put(IndexTemplateMetadata.Builder.fromXContent(parser, parser.currentName())); } } else { try { @@ -1590,22 +1590,22 @@ public class MetaData implements Iterable, Diffable, To static { Map params = new HashMap<>(2); params.put("binary", "true"); - params.put(MetaData.CONTEXT_MODE_PARAM, MetaData.CONTEXT_MODE_GATEWAY); + params.put(Metadata.CONTEXT_MODE_PARAM, Metadata.CONTEXT_MODE_GATEWAY); FORMAT_PARAMS = new MapParams(params); } /** - * State format for {@link MetaData} to write to and load from disk + * State format for {@link Metadata} to write to and load from disk */ - public static final MetaDataStateFormat FORMAT = new MetaDataStateFormat(GLOBAL_STATE_FILE_PREFIX) { + public static final MetadataStateFormat FORMAT = new MetadataStateFormat(GLOBAL_STATE_FILE_PREFIX) { @Override - public void toXContent(XContentBuilder builder, MetaData state) throws IOException { + public void toXContent(XContentBuilder builder, Metadata state) throws IOException { Builder.toXContent(state, builder, FORMAT_PARAMS); } @Override - public MetaData fromXContent(XContentParser parser) throws IOException { + public Metadata fromXContent(XContentParser parser) throws IOException { return Builder.fromXContent(parser); } }; diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexService.java similarity index 84% rename from server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java rename to server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexService.java index d19a11b16bd..dc6043389ff 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexService.java @@ -98,17 +98,17 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; import static java.util.stream.Collectors.toList; -import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS; -import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_CREATION_DATE; -import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_INDEX_UUID; -import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; -import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; +import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_AUTO_EXPAND_REPLICAS; +import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_CREATION_DATE; +import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_INDEX_UUID; +import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS; +import static org.elasticsearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS; /** * Service responsible for submitting create index requests */ -public class MetaDataCreateIndexService { - private static final Logger logger = LogManager.getLogger(MetaDataCreateIndexService.class); +public class MetadataCreateIndexService { + private static final Logger logger = LogManager.getLogger(MetadataCreateIndexService.class); private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(logger); public static final int MAX_INDEX_NAME_BYTES = 255; @@ -125,7 +125,7 @@ public class MetaDataCreateIndexService { private final Collection systemIndexDescriptors; private final boolean forbidPrivateIndexSettings; - public MetaDataCreateIndexService( + public MetadataCreateIndexService( final Settings settings, final ClusterService clusterService, final IndicesService indicesService, @@ -164,10 +164,10 @@ public class MetaDataCreateIndexService { if (state.routingTable().hasIndex(index)) { throw new ResourceAlreadyExistsException(state.routingTable().index(index).getIndex()); } - if (state.metaData().hasIndex(index)) { - throw new ResourceAlreadyExistsException(state.metaData().index(index).getIndex()); + if (state.metadata().hasIndex(index)) { + throw new ResourceAlreadyExistsException(state.metadata().index(index).getIndex()); } - if (state.metaData().hasAlias(index)) { + if (state.metadata().hasAlias(index)) { throw new InvalidIndexNameException(index, "already exists as alias"); } } @@ -268,7 +268,7 @@ public class MetaDataCreateIndexService { private void onlyCreateIndex(final CreateIndexClusterStateUpdateRequest request, final ActionListener listener) { Settings.Builder updatedSettingsBuilder = Settings.builder(); - Settings build = updatedSettingsBuilder.put(request.settings()).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX).build(); + Settings build = updatedSettingsBuilder.put(request.settings()).normalizePrefix(IndexMetadata.INDEX_SETTING_PREFIX).build(); indexScopedSettings.validate(build, true); // we do validate here - index setting must be consistent request.settings(build); clusterService.submitStateUpdateTask( @@ -307,14 +307,14 @@ public class MetaDataCreateIndexService { validate(request, currentState); final Index recoverFromIndex = request.recoverFrom(); - final IndexMetaData sourceMetaData = recoverFromIndex == null ? null : currentState.metaData().getIndexSafe(recoverFromIndex); + final IndexMetadata sourceMetadata = recoverFromIndex == null ? null : currentState.metadata().getIndexSafe(recoverFromIndex); // we only find a template when its an API call (a new index) // find templates, highest order are better matching - final Boolean isHiddenFromRequest = IndexMetaData.INDEX_HIDDEN_SETTING.exists(request.settings()) ? - IndexMetaData.INDEX_HIDDEN_SETTING.get(request.settings()) : null; - final List templates = sourceMetaData == null ? - Collections.unmodifiableList(MetaDataIndexTemplateService.findTemplates(currentState.metaData(), + final Boolean isHiddenFromRequest = IndexMetadata.INDEX_HIDDEN_SETTING.exists(request.settings()) ? + IndexMetadata.INDEX_HIDDEN_SETTING.get(request.settings()) : null; + final List templates = sourceMetadata == null ? + Collections.unmodifiableList(MetadataIndexTemplateService.findTemplates(currentState.metadata(), request.index(), isHiddenFromRequest)) : Collections.emptyList(); @@ -323,28 +323,28 @@ public class MetaDataCreateIndexService { xContentRegistry)); final Settings aggregatedIndexSettings = - aggregateIndexSettings(currentState, request, templates, mappings, sourceMetaData, settings, indexScopedSettings); - int routingNumShards = getIndexNumberOfRoutingShards(aggregatedIndexSettings, sourceMetaData); + aggregateIndexSettings(currentState, request, templates, mappings, sourceMetadata, settings, indexScopedSettings); + int routingNumShards = getIndexNumberOfRoutingShards(aggregatedIndexSettings, sourceMetadata); - final boolean isHiddenAfterTemplates = IndexMetaData.INDEX_HIDDEN_SETTING.get(aggregatedIndexSettings); + final boolean isHiddenAfterTemplates = IndexMetadata.INDEX_HIDDEN_SETTING.get(aggregatedIndexSettings); validateDotIndex(request.index(), currentState, isHiddenAfterTemplates); // remove the setting it's temporary and is only relevant once we create the index final Settings.Builder settingsBuilder = Settings.builder().put(aggregatedIndexSettings); - settingsBuilder.remove(IndexMetaData.INDEX_NUMBER_OF_ROUTING_SHARDS_SETTING.getKey()); + settingsBuilder.remove(IndexMetadata.INDEX_NUMBER_OF_ROUTING_SHARDS_SETTING.getKey()); final Settings indexSettings = settingsBuilder.build(); - final IndexMetaData.Builder tmpImdBuilder = IndexMetaData.builder(request.index()); + final IndexMetadata.Builder tmpImdBuilder = IndexMetadata.builder(request.index()); tmpImdBuilder.setRoutingNumShards(routingNumShards); tmpImdBuilder.settings(indexSettings); // Set up everything, now locally create the index to see that things are ok, and apply - IndexMetaData tmpImd = tmpImdBuilder.build(); + IndexMetadata tmpImd = tmpImdBuilder.build(); validateActiveShardCount(request.waitForActiveShards(), tmpImd); // create the index here (on the master) to validate it can be created, as well as adding the mapping return indicesService.withTempIndexService(tmpImd, indexService -> { try { - updateIndexMappingsAndBuildSortOrder(indexService, mappings, sourceMetaData); + updateIndexMappingsAndBuildSortOrder(indexService, mappings, sourceMetadata); } catch (Exception e) { logger.debug("failed on parsing mappings on index creation [{}]", request.index()); throw e; @@ -352,28 +352,28 @@ public class MetaDataCreateIndexService { // the context is only used for validation so it's fine to pass fake values for the shard id and the current // timestamp - final List aliases = Collections.unmodifiableList( - resolveAndValidateAliases(request.index(), request.aliases(), templates, currentState.metaData(), aliasValidator, + final List aliases = Collections.unmodifiableList( + resolveAndValidateAliases(request.index(), request.aliases(), templates, currentState.metadata(), aliasValidator, xContentRegistry, indexService.newQueryShardContext(0, null, () -> 0L, null)) ); - final IndexMetaData indexMetaData; + final IndexMetadata indexMetadata; try { MapperService mapperService = indexService.mapperService(); - indexMetaData = buildIndexMetaData(request.index(), aliases, mapperService::documentMapper, - () -> mapperService.documentMapper(MapperService.DEFAULT_MAPPING), indexSettings, routingNumShards, sourceMetaData); + indexMetadata = buildIndexMetadata(request.index(), aliases, mapperService::documentMapper, + () -> mapperService.documentMapper(MapperService.DEFAULT_MAPPING), indexSettings, routingNumShards, sourceMetadata); } catch (Exception e) { logger.info("failed to build index metadata [{}]", request.index()); throw e; } logger.log(silent ? Level.DEBUG : Level.INFO, "[{}] creating index, cause [{}], templates {}, shards [{}]/[{}], mappings {}", - request.index(), request.cause(), templates.stream().map(IndexTemplateMetaData::getName).collect(toList()), - indexMetaData.getNumberOfShards(), indexMetaData.getNumberOfReplicas(), mappings.keySet()); + request.index(), request.cause(), templates.stream().map(IndexTemplateMetadata::getName).collect(toList()), + indexMetadata.getNumberOfShards(), indexMetadata.getNumberOfReplicas(), mappings.keySet()); - indexService.getIndexEventListener().beforeIndexAddedToCluster(indexMetaData.getIndex(), - indexMetaData.getSettings()); - return clusterStateCreateIndex(currentState, request.blocks(), indexMetaData, allocationService::reroute); + indexService.getIndexEventListener().beforeIndexAddedToCluster(indexMetadata.getIndex(), + indexMetadata.getSettings()); + return clusterStateCreateIndex(currentState, request.blocks(), indexMetadata, allocationService::reroute); }); } @@ -381,9 +381,9 @@ public class MetaDataCreateIndexService { * Parses the provided mappings json and the inheritable mappings from the templates (if any) into a map. * * The template mappings are applied in the order they are encountered in the list (clients should make sure the lower index, closer - * to the head of the list, templates have the highest {@link IndexTemplateMetaData#order()}) + * to the head of the list, templates have the highest {@link IndexTemplateMetadata#order()}) */ - static Map> parseMappings(Map requestMappings, List templates, + static Map> parseMappings(Map requestMappings, List templates, NamedXContentRegistry xContentRegistry) throws Exception { Map> mappings = new HashMap<>(); for (Map.Entry entry : requestMappings.entrySet()) { @@ -394,7 +394,7 @@ public class MetaDataCreateIndexService { } // apply templates, merging the mappings into the request mapping if exists - for (IndexTemplateMetaData template : templates) { + for (IndexTemplateMetadata template : templates) { for (ObjectObjectCursor cursor : template.mappings()) { String mappingString = cursor.value.string(); if (mappings.containsKey(cursor.key)) { @@ -437,16 +437,16 @@ public class MetaDataCreateIndexService { * clone), the resize settings. * * The template mappings are applied in the order they are encountered in the list (clients should make sure the lower index, closer - * to the head of the list, templates have the highest {@link IndexTemplateMetaData#order()}) + * to the head of the list, templates have the highest {@link IndexTemplateMetadata#order()}) * * @return the aggregated settings for the new index */ static Settings aggregateIndexSettings(ClusterState currentState, CreateIndexClusterStateUpdateRequest request, - List templates, Map> mappings, - @Nullable IndexMetaData sourceMetaData, Settings settings, + List templates, Map> mappings, + @Nullable IndexMetadata sourceMetadata, Settings settings, IndexScopedSettings indexScopedSettings) { Settings.Builder indexSettingsBuilder = Settings.builder(); - if (sourceMetaData == null) { + if (sourceMetadata == null) { // apply templates, here, in reverse order, since first ones are better matching for (int i = templates.size() - 1; i >= 0; i--) { indexSettingsBuilder.put(templates.get(i).settings()); @@ -454,10 +454,10 @@ public class MetaDataCreateIndexService { } // now, put the request settings, so they override templates indexSettingsBuilder.put(request.settings()); - if (indexSettingsBuilder.get(IndexMetaData.SETTING_INDEX_VERSION_CREATED.getKey()) == null) { + if (indexSettingsBuilder.get(IndexMetadata.SETTING_INDEX_VERSION_CREATED.getKey()) == null) { final DiscoveryNodes nodes = currentState.nodes(); final Version createdVersion = Version.min(Version.CURRENT, nodes.getSmallestNonClientNodeVersion()); - indexSettingsBuilder.put(IndexMetaData.SETTING_INDEX_VERSION_CREATED.getKey(), createdVersion); + indexSettingsBuilder.put(IndexMetadata.SETTING_INDEX_VERSION_CREATED.getKey(), createdVersion); } if (indexSettingsBuilder.get(SETTING_NUMBER_OF_SHARDS) == null) { final int numberOfShards = getNumberOfShards(indexSettingsBuilder); @@ -473,10 +473,10 @@ public class MetaDataCreateIndexService { if (indexSettingsBuilder.get(SETTING_CREATION_DATE) == null) { indexSettingsBuilder.put(SETTING_CREATION_DATE, Instant.now().toEpochMilli()); } - indexSettingsBuilder.put(IndexMetaData.SETTING_INDEX_PROVIDED_NAME, request.getProvidedName()); + indexSettingsBuilder.put(IndexMetadata.SETTING_INDEX_PROVIDED_NAME, request.getProvidedName()); indexSettingsBuilder.put(SETTING_INDEX_UUID, UUIDs.randomBase64UUID()); - if (sourceMetaData != null) { + if (sourceMetadata != null) { assert request.resizeType() != null; prepareResizeIndexSettings( currentState, @@ -494,7 +494,7 @@ public class MetaDataCreateIndexService { * We can not check the shard limit until we have applied templates, otherwise we do not know the actual number of shards * that will be used to create this index. */ - MetaDataCreateIndexService.checkShardLimit(indexSettings, currentState); + MetadataCreateIndexService.checkShardLimit(indexSettings, currentState); if (indexSettings.getAsBoolean(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true) == false) { DEPRECATION_LOGGER.deprecatedAndMaybeLog("soft_deletes_disabled", "Creating indices with soft-deletes disabled is deprecated and will be removed in future Elasticsearch versions. " + @@ -509,7 +509,7 @@ public class MetaDataCreateIndexService { assert Version.CURRENT.major == 7; final int numberOfShards; final Version indexVersionCreated = - Version.fromId(Integer.parseInt(indexSettingsBuilder.get(IndexMetaData.SETTING_INDEX_VERSION_CREATED.getKey()))); + Version.fromId(Integer.parseInt(indexSettingsBuilder.get(IndexMetadata.SETTING_INDEX_VERSION_CREATED.getKey()))); if (indexVersionCreated.before(Version.V_7_0_0)) { numberOfShards = 5; } else { @@ -522,23 +522,23 @@ public class MetaDataCreateIndexService { * Calculates the number of routing shards based on the configured value in indexSettings or if recovering from another index * it will return the value configured for that index. */ - static int getIndexNumberOfRoutingShards(Settings indexSettings, @Nullable IndexMetaData sourceMetaData) { - final int numTargetShards = IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.get(indexSettings); - final Version indexVersionCreated = IndexMetaData.SETTING_INDEX_VERSION_CREATED.get(indexSettings); + static int getIndexNumberOfRoutingShards(Settings indexSettings, @Nullable IndexMetadata sourceMetadata) { + final int numTargetShards = IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.get(indexSettings); + final Version indexVersionCreated = IndexMetadata.SETTING_INDEX_VERSION_CREATED.get(indexSettings); final int routingNumShards; - if (sourceMetaData == null || sourceMetaData.getNumberOfShards() == 1) { + if (sourceMetadata == null || sourceMetadata.getNumberOfShards() == 1) { // in this case we either have no index to recover from or // we have a source index with 1 shard and without an explicit split factor // or one that is valid in that case we can split into whatever and auto-generate a new factor. - if (IndexMetaData.INDEX_NUMBER_OF_ROUTING_SHARDS_SETTING.exists(indexSettings)) { - routingNumShards = IndexMetaData.INDEX_NUMBER_OF_ROUTING_SHARDS_SETTING.get(indexSettings); + if (IndexMetadata.INDEX_NUMBER_OF_ROUTING_SHARDS_SETTING.exists(indexSettings)) { + routingNumShards = IndexMetadata.INDEX_NUMBER_OF_ROUTING_SHARDS_SETTING.get(indexSettings); } else { routingNumShards = calculateNumRoutingShards(numTargetShards, indexVersionCreated); } } else { - assert IndexMetaData.INDEX_NUMBER_OF_ROUTING_SHARDS_SETTING.exists(indexSettings) == false + assert IndexMetadata.INDEX_NUMBER_OF_ROUTING_SHARDS_SETTING.exists(indexSettings) == false : "index.number_of_routing_shards should not be present on the target index on resize"; - routingNumShards = sourceMetaData.getRoutingNumShards(); + routingNumShards = sourceMetadata.getRoutingNumShards(); } return routingNumShards; } @@ -548,34 +548,34 @@ public class MetaDataCreateIndexService { * templates. * * The template mappings are applied in the order they are encountered in the list (clients should make sure the lower index, closer - * to the head of the list, templates have the highest {@link IndexTemplateMetaData#order()}) + * to the head of the list, templates have the highest {@link IndexTemplateMetadata#order()}) * * @return the list of resolved aliases, with the explicitly provided aliases occurring first (having a higher priority) followed by * the ones inherited from the templates */ - static List resolveAndValidateAliases(String index, Set aliases, List templates, - MetaData metaData, AliasValidator aliasValidator, + static List resolveAndValidateAliases(String index, Set aliases, List templates, + Metadata metadata, AliasValidator aliasValidator, NamedXContentRegistry xContentRegistry, QueryShardContext queryShardContext) { - List resolvedAliases = new ArrayList<>(); + List resolvedAliases = new ArrayList<>(); for (Alias alias : aliases) { - aliasValidator.validateAlias(alias, index, metaData); + aliasValidator.validateAlias(alias, index, metadata); if (Strings.hasLength(alias.filter())) { aliasValidator.validateAliasFilter(alias.name(), alias.filter(), queryShardContext, xContentRegistry); } - AliasMetaData aliasMetaData = AliasMetaData.builder(alias.name()).filter(alias.filter()) + AliasMetadata aliasMetadata = AliasMetadata.builder(alias.name()).filter(alias.filter()) .indexRouting(alias.indexRouting()).searchRouting(alias.searchRouting()).writeIndex(alias.writeIndex()) .isHidden(alias.isHidden()).build(); - resolvedAliases.add(aliasMetaData); + resolvedAliases.add(aliasMetadata); } - Map templatesAliases = new HashMap<>(); - for (IndexTemplateMetaData template : templates) { + Map templatesAliases = new HashMap<>(); + for (IndexTemplateMetadata template : templates) { // handle aliases - for (ObjectObjectCursor cursor : template.aliases()) { - AliasMetaData aliasMetaData = cursor.value; + for (ObjectObjectCursor cursor : template.aliases()) { + AliasMetadata aliasMetadata = cursor.value; // if an alias with same name came with the create index request itself, // ignore this one taken from the index template - if (aliases.contains(new Alias(aliasMetaData.alias()))) { + if (aliases.contains(new Alias(aliasMetadata.alias()))) { continue; } // if an alias with same name was already processed, ignore this one @@ -585,18 +585,18 @@ public class MetaDataCreateIndexService { // Allow templatesAliases to be templated by replacing a token with the // name of the index that we are applying it to - if (aliasMetaData.alias().contains("{index}")) { - String templatedAlias = aliasMetaData.alias().replace("{index}", index); - aliasMetaData = AliasMetaData.newAliasMetaData(aliasMetaData, templatedAlias); + if (aliasMetadata.alias().contains("{index}")) { + String templatedAlias = aliasMetadata.alias().replace("{index}", index); + aliasMetadata = AliasMetadata.newAliasMetadata(aliasMetadata, templatedAlias); } - aliasValidator.validateAliasMetaData(aliasMetaData, index, metaData); - if (aliasMetaData.filter() != null) { - aliasValidator.validateAliasFilter(aliasMetaData.alias(), aliasMetaData.filter().uncompressed(), + aliasValidator.validateAliasMetadata(aliasMetadata, index, metadata); + if (aliasMetadata.filter() != null) { + aliasValidator.validateAliasFilter(aliasMetadata.alias(), aliasMetadata.filter().uncompressed(), queryShardContext, xContentRegistry); } - templatesAliases.put(aliasMetaData.alias(), aliasMetaData); - resolvedAliases.add((aliasMetaData)); + templatesAliases.put(aliasMetadata.alias(), aliasMetadata); + resolvedAliases.add((aliasMetadata)); } } return resolvedAliases; @@ -606,63 +606,63 @@ public class MetaDataCreateIndexService { * Creates the index into the cluster state applying the provided blocks. The final cluster state will contain an updated routing * table based on the live nodes. */ - static ClusterState clusterStateCreateIndex(ClusterState currentState, Set clusterBlocks, IndexMetaData indexMetaData, + static ClusterState clusterStateCreateIndex(ClusterState currentState, Set clusterBlocks, IndexMetadata indexMetadata, BiFunction rerouteRoutingTable) { - MetaData newMetaData = MetaData.builder(currentState.metaData()) - .put(indexMetaData, false) + Metadata newMetadata = Metadata.builder(currentState.metadata()) + .put(indexMetadata, false) .build(); - String indexName = indexMetaData.getIndex().getName(); + String indexName = indexMetadata.getIndex().getName(); ClusterBlocks.Builder blocks = createClusterBlocksBuilder(currentState, indexName, clusterBlocks); - blocks.updateBlocks(indexMetaData); + blocks.updateBlocks(indexMetadata); - ClusterState updatedState = ClusterState.builder(currentState).blocks(blocks).metaData(newMetaData).build(); + ClusterState updatedState = ClusterState.builder(currentState).blocks(blocks).metadata(newMetadata).build(); RoutingTable.Builder routingTableBuilder = RoutingTable.builder(updatedState.routingTable()) - .addAsNew(updatedState.metaData().index(indexName)); + .addAsNew(updatedState.metadata().index(indexName)); updatedState = ClusterState.builder(updatedState).routingTable(routingTableBuilder.build()).build(); return rerouteRoutingTable.apply(updatedState, "index [" + indexName + "] created"); } - static IndexMetaData buildIndexMetaData(String indexName, List aliases, + static IndexMetadata buildIndexMetadata(String indexName, List aliases, Supplier documentMapperSupplier, Supplier defaultDocumentMapperSupplier, Settings indexSettings, - int routingNumShards, @Nullable IndexMetaData sourceMetaData) { - IndexMetaData.Builder indexMetaDataBuilder = createIndexMetadataBuilder(indexName, sourceMetaData, indexSettings, routingNumShards); + int routingNumShards, @Nullable IndexMetadata sourceMetadata) { + IndexMetadata.Builder indexMetadataBuilder = createIndexMetadataBuilder(indexName, sourceMetadata, indexSettings, routingNumShards); // now, update the mappings with the actual source - Map mappingsMetaData = new HashMap<>(); + Map mappingsMetadata = new HashMap<>(); for (DocumentMapper mapper : Arrays.asList(documentMapperSupplier.get(), defaultDocumentMapperSupplier.get())) { if (mapper != null) { - MappingMetaData mappingMd = new MappingMetaData(mapper); - mappingsMetaData.put(mapper.type(), mappingMd); + MappingMetadata mappingMd = new MappingMetadata(mapper); + mappingsMetadata.put(mapper.type(), mappingMd); } } - for (MappingMetaData mappingMd : mappingsMetaData.values()) { - indexMetaDataBuilder.putMapping(mappingMd); + for (MappingMetadata mappingMd : mappingsMetadata.values()) { + indexMetadataBuilder.putMapping(mappingMd); } // apply the aliases in reverse order as the lower index ones have higher order for (int i = aliases.size() - 1; i >= 0; i--) { - indexMetaDataBuilder.putAlias(aliases.get(i)); + indexMetadataBuilder.putAlias(aliases.get(i)); } - indexMetaDataBuilder.state(IndexMetaData.State.OPEN); - return indexMetaDataBuilder.build(); + indexMetadataBuilder.state(IndexMetadata.State.OPEN); + return indexMetadataBuilder.build(); } /** - * Creates an {@link IndexMetaData.Builder} for the provided index and sets a valid primary term for all the shards if a source + * Creates an {@link IndexMetadata.Builder} for the provided index and sets a valid primary term for all the shards if a source * index meta data is provided (this represents the case where we're shrinking/splitting an index and the primary term for the newly * created index needs to be gte than the maximum term in the source index). */ - private static IndexMetaData.Builder createIndexMetadataBuilder(String indexName, @Nullable IndexMetaData sourceMetaData, + private static IndexMetadata.Builder createIndexMetadataBuilder(String indexName, @Nullable IndexMetadata sourceMetadata, Settings indexSettings, int routingNumShards) { - final IndexMetaData.Builder builder = IndexMetaData.builder(indexName); + final IndexMetadata.Builder builder = IndexMetadata.builder(indexName); builder.setRoutingNumShards(routingNumShards); builder.settings(indexSettings); - if (sourceMetaData != null) { + if (sourceMetadata != null) { /* * We need to arrange that the primary term on all the shards in the shrunken index is at least as large as * the maximum primary term on all the shards in the source index. This ensures that we have correct @@ -670,8 +670,8 @@ public class MetaDataCreateIndexService { */ final long primaryTerm = IntStream - .range(0, sourceMetaData.getNumberOfShards()) - .mapToLong(sourceMetaData::primaryTerm) + .range(0, sourceMetadata.getNumberOfShards()) + .mapToLong(sourceMetadata::primaryTerm) .max() .getAsLong(); for (int shardId = 0; shardId < builder.numberOfShards(); shardId++) { @@ -692,7 +692,7 @@ public class MetaDataCreateIndexService { } private static void updateIndexMappingsAndBuildSortOrder(IndexService indexService, Map> mappings, - @Nullable IndexMetaData sourceMetaData) throws IOException { + @Nullable IndexMetadata sourceMetadata) throws IOException { MapperService mapperService = indexService.mapperService(); if (!mappings.isEmpty()) { assert mappings.size() == 1 : mappings; @@ -700,7 +700,7 @@ public class MetaDataCreateIndexService { mapperService.merge(mappings, MergeReason.MAPPING_UPDATE); } - if (sourceMetaData == null) { + if (sourceMetadata == null) { // now that the mapping is merged we can validate the index sort. // we cannot validate for index shrinking since the mapping is empty // at this point. The validation will take place later in the process @@ -709,14 +709,14 @@ public class MetaDataCreateIndexService { } } - private static void validateActiveShardCount(ActiveShardCount waitForActiveShards, IndexMetaData indexMetaData) { + private static void validateActiveShardCount(ActiveShardCount waitForActiveShards, IndexMetadata indexMetadata) { if (waitForActiveShards == ActiveShardCount.DEFAULT) { - waitForActiveShards = indexMetaData.getWaitForActiveShards(); + waitForActiveShards = indexMetadata.getWaitForActiveShards(); } - if (waitForActiveShards.validate(indexMetaData.getNumberOfReplicas()) == false) { + if (waitForActiveShards.validate(indexMetadata.getNumberOfReplicas()) == false) { throw new IllegalArgumentException("invalid wait_for_active_shards[" + waitForActiveShards + "]: cannot be greater than number of shard copies [" + - (indexMetaData.getNumberOfReplicas() + 1) + "]"); + (indexMetadata.getNumberOfReplicas() + 1) + "]"); } } @@ -744,8 +744,8 @@ public class MetaDataCreateIndexService { * @throws ValidationException if creating this index would put the cluster over the cluster shard limit */ public static void checkShardLimit(final Settings settings, final ClusterState clusterState) { - final int numberOfShards = IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.get(settings); - final int numberOfReplicas = IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.get(settings); + final int numberOfShards = IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.get(settings); + final int numberOfReplicas = IndexMetadata.INDEX_NUMBER_OF_REPLICAS_SETTING.get(settings); final int shardsToCreate = numberOfShards * (1 + numberOfReplicas); final Optional shardLimit = IndicesService.checkShardLimit(shardsToCreate, clusterState); @@ -785,7 +785,7 @@ public class MetaDataCreateIndexService { * @return a list containing validaton errors or an empty list if there aren't any errors */ private static List validateIndexCustomPath(Settings settings, @Nullable Path sharedDataPath) { - String customPath = IndexMetaData.INDEX_DATA_PATH_SETTING.get(settings); + String customPath = IndexMetadata.INDEX_DATA_PATH_SETTING.get(settings); List validationErrors = new ArrayList<>(); if (!Strings.isEmpty(customPath)) { if (sharedDataPath == null) { @@ -809,18 +809,18 @@ public class MetaDataCreateIndexService { static List validateShrinkIndex(ClusterState state, String sourceIndex, Set targetIndexMappingsTypes, String targetIndexName, Settings targetIndexSettings) { - IndexMetaData sourceMetaData = validateResize(state, sourceIndex, targetIndexMappingsTypes, targetIndexName, targetIndexSettings); - assert IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.exists(targetIndexSettings); - IndexMetaData.selectShrinkShards(0, sourceMetaData, IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.get(targetIndexSettings)); + IndexMetadata sourceMetadata = validateResize(state, sourceIndex, targetIndexMappingsTypes, targetIndexName, targetIndexSettings); + assert IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.exists(targetIndexSettings); + IndexMetadata.selectShrinkShards(0, sourceMetadata, IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.get(targetIndexSettings)); - if (sourceMetaData.getNumberOfShards() == 1) { + if (sourceMetadata.getNumberOfShards() == 1) { throw new IllegalArgumentException("can't shrink an index with only one shard"); } // now check that index is all on one node final IndexRoutingTable table = state.routingTable().index(sourceIndex); Map nodesToNumRouting = new HashMap<>(); - int numShards = sourceMetaData.getNumberOfShards(); + int numShards = sourceMetadata.getNumberOfShards(); for (ShardRouting routing : table.shardsWithState(ShardRoutingState.STARTED)) { nodesToNumRouting.computeIfAbsent(routing.currentNodeId(), (s) -> new AtomicInteger(0)).incrementAndGet(); } @@ -842,9 +842,9 @@ public class MetaDataCreateIndexService { static void validateSplitIndex(ClusterState state, String sourceIndex, Set targetIndexMappingsTypes, String targetIndexName, Settings targetIndexSettings) { - IndexMetaData sourceMetaData = validateResize(state, sourceIndex, targetIndexMappingsTypes, targetIndexName, targetIndexSettings); - IndexMetaData.selectSplitShard(0, sourceMetaData, IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.get(targetIndexSettings)); - if (sourceMetaData.getCreationVersion().before(Version.V_6_0_0_alpha1)) { + IndexMetadata sourceMetadata = validateResize(state, sourceIndex, targetIndexMappingsTypes, targetIndexName, targetIndexSettings); + IndexMetadata.selectSplitShard(0, sourceMetadata, IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.get(targetIndexSettings)); + if (sourceMetadata.getCreationVersion().before(Version.V_6_0_0_alpha1)) { // ensure we have a single type since this would make the splitting code considerably more complex // and a 5.x index would not be splittable unless it has been shrunk before so rather opt out of the complexity // since in 5.x we don't have a setting to artificially set the number of routing shards @@ -856,18 +856,18 @@ public class MetaDataCreateIndexService { static void validateCloneIndex(ClusterState state, String sourceIndex, Set targetIndexMappingsTypes, String targetIndexName, Settings targetIndexSettings) { - IndexMetaData sourceMetaData = validateResize(state, sourceIndex, targetIndexMappingsTypes, targetIndexName, targetIndexSettings); - IndexMetaData.selectCloneShard(0, sourceMetaData, IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.get(targetIndexSettings)); + IndexMetadata sourceMetadata = validateResize(state, sourceIndex, targetIndexMappingsTypes, targetIndexName, targetIndexSettings); + IndexMetadata.selectCloneShard(0, sourceMetadata, IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.get(targetIndexSettings)); } - static IndexMetaData validateResize(ClusterState state, String sourceIndex, + static IndexMetadata validateResize(ClusterState state, String sourceIndex, Set targetIndexMappingsTypes, String targetIndexName, Settings targetIndexSettings) { - if (state.metaData().hasIndex(targetIndexName)) { - throw new ResourceAlreadyExistsException(state.metaData().index(targetIndexName).getIndex()); + if (state.metadata().hasIndex(targetIndexName)) { + throw new ResourceAlreadyExistsException(state.metadata().index(targetIndexName).getIndex()); } - final IndexMetaData sourceMetaData = state.metaData().index(sourceIndex); - if (sourceMetaData == null) { + final IndexMetadata sourceMetadata = state.metadata().index(sourceIndex); + if (sourceMetadata == null) { throw new IndexNotFoundException(sourceIndex); } // ensure index is read-only @@ -881,13 +881,13 @@ public class MetaDataCreateIndexService { ", all mappings are copied from the source index"); } - if (IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.exists(targetIndexSettings)) { + if (IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.exists(targetIndexSettings)) { // this method applies all necessary checks ie. if the target shards are less than the source shards // of if the source shards are divisible by the number of target shards - IndexMetaData.getRoutingFactor(sourceMetaData.getNumberOfShards(), - IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.get(targetIndexSettings)); + IndexMetadata.getRoutingFactor(sourceMetadata.getNumberOfShards(), + IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING.get(targetIndexSettings)); } - return sourceMetaData; + return sourceMetadata; } static void prepareResizeIndexSettings( @@ -902,9 +902,9 @@ public class MetaDataCreateIndexService { // we use "i.r.a.initial_recovery" rather than "i.r.a.require|include" since we want the replica to allocate right away // once we are allocated. - final String initialRecoveryIdFilter = IndexMetaData.INDEX_ROUTING_INITIAL_RECOVERY_GROUP_SETTING.getKey() + "_id"; + final String initialRecoveryIdFilter = IndexMetadata.INDEX_ROUTING_INITIAL_RECOVERY_GROUP_SETTING.getKey() + "_id"; - final IndexMetaData sourceMetaData = currentState.metaData().index(resizeSourceIndex.getName()); + final IndexMetadata sourceMetadata = currentState.metadata().index(resizeSourceIndex.getName()); if (type == ResizeType.SHRINK) { final List nodesToAllocateOn = validateShrinkIndex(currentState, resizeSourceIndex.getName(), mappingKeys, resizeIntoName, indexSettingsBuilder.build()); @@ -922,7 +922,7 @@ public class MetaDataCreateIndexService { final Settings.Builder builder = Settings.builder(); if (copySettings) { // copy all settings and non-copyable settings and settings that have already been set (e.g., from the request) - for (final String key : sourceMetaData.getSettings().keySet()) { + for (final String key : sourceMetadata.getSettings().keySet()) { final Setting setting = indexScopedSettings.get(key); if (setting == null) { assert indexScopedSettings.isPrivateSetting(key) : key; @@ -933,23 +933,23 @@ public class MetaDataCreateIndexService { if (indexSettingsBuilder.keys().contains(key)) { continue; } - builder.copy(key, sourceMetaData.getSettings()); + builder.copy(key, sourceMetadata.getSettings()); } } else { final Predicate sourceSettingsPredicate = (s) -> (s.startsWith("index.similarity.") || s.startsWith("index.analysis.") || s.startsWith("index.sort.") || s.equals("index.soft_deletes.enabled")) && indexSettingsBuilder.keys().contains(s) == false; - builder.put(sourceMetaData.getSettings().filter(sourceSettingsPredicate)); + builder.put(sourceMetadata.getSettings().filter(sourceSettingsPredicate)); } indexSettingsBuilder - .put(IndexMetaData.SETTING_INDEX_VERSION_CREATED.getKey(), sourceMetaData.getCreationVersion()) - .put(IndexMetaData.SETTING_VERSION_UPGRADED, sourceMetaData.getUpgradedVersion()) + .put(IndexMetadata.SETTING_INDEX_VERSION_CREATED.getKey(), sourceMetadata.getCreationVersion()) + .put(IndexMetadata.SETTING_VERSION_UPGRADED, sourceMetadata.getUpgradedVersion()) .put(builder.build()) - .put(IndexMetaData.SETTING_ROUTING_PARTITION_SIZE, sourceMetaData.getRoutingPartitionSize()) - .put(IndexMetaData.INDEX_RESIZE_SOURCE_NAME.getKey(), resizeSourceIndex.getName()) - .put(IndexMetaData.INDEX_RESIZE_SOURCE_UUID.getKey(), resizeSourceIndex.getUUID()); + .put(IndexMetadata.SETTING_ROUTING_PARTITION_SIZE, sourceMetadata.getRoutingPartitionSize()) + .put(IndexMetadata.INDEX_RESIZE_SOURCE_NAME.getKey(), resizeSourceIndex.getName()) + .put(IndexMetadata.INDEX_RESIZE_SOURCE_UUID.getKey(), resizeSourceIndex.getUUID()); } /** diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataDeleteIndexService.java b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataDeleteIndexService.java similarity index 92% rename from server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataDeleteIndexService.java rename to server/src/main/java/org/elasticsearch/cluster/metadata/MetadataDeleteIndexService.java index fe71b2beefe..905ffe3fe13 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataDeleteIndexService.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataDeleteIndexService.java @@ -49,9 +49,9 @@ import static java.util.stream.Collectors.toSet; /** * Deletes indices. */ -public class MetaDataDeleteIndexService { +public class MetadataDeleteIndexService { - private static final Logger logger = LogManager.getLogger(MetaDataDeleteIndexService.class); + private static final Logger logger = LogManager.getLogger(MetadataDeleteIndexService.class); private final Settings settings; private final ClusterService clusterService; @@ -59,7 +59,7 @@ public class MetaDataDeleteIndexService { private final AllocationService allocationService; @Inject - public MetaDataDeleteIndexService(Settings settings, ClusterService clusterService, AllocationService allocationService) { + public MetadataDeleteIndexService(Settings settings, ClusterService clusterService, AllocationService allocationService) { this.settings = settings; this.clusterService = clusterService; this.allocationService = allocationService; @@ -90,7 +90,7 @@ public class MetaDataDeleteIndexService { * Delete some indices from the cluster state. */ public ClusterState deleteIndices(ClusterState currentState, Set indices) { - final MetaData meta = currentState.metaData(); + final Metadata meta = currentState.metadata(); final Set indicesToDelete = indices.stream().map(i -> meta.getIndexSafe(i).getIndex()).collect(toSet()); // Check if index deletion conflicts with any running snapshots @@ -101,25 +101,25 @@ public class MetaDataDeleteIndexService { } RoutingTable.Builder routingTableBuilder = RoutingTable.builder(currentState.routingTable()); - MetaData.Builder metaDataBuilder = MetaData.builder(meta); + Metadata.Builder metadataBuilder = Metadata.builder(meta); ClusterBlocks.Builder clusterBlocksBuilder = ClusterBlocks.builder().blocks(currentState.blocks()); - final IndexGraveyard.Builder graveyardBuilder = IndexGraveyard.builder(metaDataBuilder.indexGraveyard()); + final IndexGraveyard.Builder graveyardBuilder = IndexGraveyard.builder(metadataBuilder.indexGraveyard()); final int previousGraveyardSize = graveyardBuilder.tombstones().size(); for (final Index index : indices) { String indexName = index.getName(); logger.info("{} deleting index", index); routingTableBuilder.remove(indexName); clusterBlocksBuilder.removeIndexBlocks(indexName); - metaDataBuilder.remove(indexName); + metadataBuilder.remove(indexName); } // add tombstones to the cluster state for each deleted index final IndexGraveyard currentGraveyard = graveyardBuilder.addTombstones(indices).build(settings); - metaDataBuilder.indexGraveyard(currentGraveyard); // the new graveyard set on the metadata + metadataBuilder.indexGraveyard(currentGraveyard); // the new graveyard set on the metadata logger.trace("{} tombstones purged from the cluster state. Previous tombstone size: {}. Current tombstone size: {}.", graveyardBuilder.getNumPurged(), previousGraveyardSize, currentGraveyard.getTombstones().size()); - MetaData newMetaData = metaDataBuilder.build(); + Metadata newMetadata = metadataBuilder.build(); ClusterBlocks blocks = clusterBlocksBuilder.build(); // update snapshot restore entries @@ -137,7 +137,7 @@ public class MetaDataDeleteIndexService { return allocationService.reroute( ClusterState.builder(currentState) .routingTable(routingTableBuilder.build()) - .metaData(newMetaData) + .metadata(newMetadata) .blocks(blocks) .customs(customs) .build(), diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexAliasesService.java b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexAliasesService.java similarity index 87% rename from server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexAliasesService.java rename to server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexAliasesService.java index c6149682a20..f56e1a9c5de 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexAliasesService.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexAliasesService.java @@ -52,7 +52,7 @@ import static org.elasticsearch.indices.cluster.IndicesClusterStateService.Alloc /** * Service responsible for submitting add and remove aliases requests */ -public class MetaDataIndexAliasesService { +public class MetadataIndexAliasesService { private final ClusterService clusterService; @@ -60,13 +60,13 @@ public class MetaDataIndexAliasesService { private final AliasValidator aliasValidator; - private final MetaDataDeleteIndexService deleteIndexService; + private final MetadataDeleteIndexService deleteIndexService; private final NamedXContentRegistry xContentRegistry; @Inject - public MetaDataIndexAliasesService(ClusterService clusterService, IndicesService indicesService, - AliasValidator aliasValidator, MetaDataDeleteIndexService deleteIndexService, NamedXContentRegistry xContentRegistry) { + public MetadataIndexAliasesService(ClusterService clusterService, IndicesService indicesService, + AliasValidator aliasValidator, MetadataDeleteIndexService deleteIndexService, NamedXContentRegistry xContentRegistry) { this.clusterService = clusterService; this.indicesService = indicesService; this.aliasValidator = aliasValidator; @@ -104,7 +104,7 @@ public class MetaDataIndexAliasesService { Set indicesToDelete = new HashSet<>(); for (AliasAction action : actions) { if (action.removeIndex()) { - IndexMetaData index = currentState.metaData().getIndices().get(action.getIndex()); + IndexMetadata index = currentState.metadata().getIndices().get(action.getIndex()); if (index == null) { throw new IndexNotFoundException(action.getIndex()); } @@ -116,7 +116,7 @@ public class MetaDataIndexAliasesService { if (changed) { currentState = deleteIndexService.deleteIndices(currentState, indicesToDelete); } - MetaData.Builder metadata = MetaData.builder(currentState.metaData()); + Metadata.Builder metadata = Metadata.builder(currentState.metadata()); // Run the remaining alias actions final Set maybeModifiedIndices = new HashSet<>(); for (AliasAction action : actions) { @@ -124,14 +124,14 @@ public class MetaDataIndexAliasesService { // Handled above continue; } - IndexMetaData index = metadata.get(action.getIndex()); + IndexMetadata index = metadata.get(action.getIndex()); if (index == null) { throw new IndexNotFoundException(action.getIndex()); } NewAliasValidator newAliasValidator = (alias, indexRouting, filter, writeIndex) -> { /* It is important that we look up the index using the metadata builder we are modifying so we can remove an * index and replace it with an alias. */ - Function indexLookup = name -> metadata.get(name); + Function indexLookup = name -> metadata.get(name); aliasValidator.validateAlias(alias, action.getIndex(), indexRouting, indexLookup); if (Strings.hasLength(filter)) { IndexService indexService = indices.get(index.getIndex().getName()); @@ -162,20 +162,20 @@ public class MetaDataIndexAliasesService { } for (final String maybeModifiedIndex : maybeModifiedIndices) { - final IndexMetaData currentIndexMetaData = currentState.metaData().index(maybeModifiedIndex); - final IndexMetaData newIndexMetaData = metadata.get(maybeModifiedIndex); + final IndexMetadata currentIndexMetadata = currentState.metadata().index(maybeModifiedIndex); + final IndexMetadata newIndexMetadata = metadata.get(maybeModifiedIndex); // only increment the aliases version if the aliases actually changed for this index - if (currentIndexMetaData.getAliases().equals(newIndexMetaData.getAliases()) == false) { - assert currentIndexMetaData.getAliasesVersion() == newIndexMetaData.getAliasesVersion(); - metadata.put(new IndexMetaData.Builder(newIndexMetaData).aliasesVersion(1 + currentIndexMetaData.getAliasesVersion())); + if (currentIndexMetadata.getAliases().equals(newIndexMetadata.getAliases()) == false) { + assert currentIndexMetadata.getAliasesVersion() == newIndexMetadata.getAliasesVersion(); + metadata.put(new IndexMetadata.Builder(newIndexMetadata).aliasesVersion(1 + currentIndexMetadata.getAliasesVersion())); } } if (changed) { - ClusterState updatedState = ClusterState.builder(currentState).metaData(metadata).build(); + ClusterState updatedState = ClusterState.builder(currentState).metadata(metadata).build(); // even though changes happened, they resulted in 0 actual changes to metadata // i.e. remove and add the same alias to the same index - if (!updatedState.metaData().equalsAliases(currentState.metaData())) { + if (!updatedState.metadata().equalsAliases(currentState.metadata())) { return updatedState; } } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexStateService.java b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexStateService.java similarity index 91% rename from server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexStateService.java rename to server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexStateService.java index b6654e04735..99bbecb63e1 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexStateService.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexStateService.java @@ -93,8 +93,8 @@ import static java.util.Collections.unmodifiableMap; /** * Service responsible for submitting open/close index requests */ -public class MetaDataIndexStateService { - private static final Logger logger = LogManager.getLogger(MetaDataIndexStateService.class); +public class MetadataIndexStateService { + private static final Logger logger = LogManager.getLogger(MetadataIndexStateService.class); public static final int INDEX_CLOSED_BLOCK_ID = 4; public static final ClusterBlock INDEX_CLOSED_BLOCK = new ClusterBlock(4, "index closed", false, @@ -104,15 +104,15 @@ public class MetaDataIndexStateService { private final ClusterService clusterService; private final AllocationService allocationService; - private final MetaDataIndexUpgradeService metaDataIndexUpgradeService; + private final MetadataIndexUpgradeService metadataIndexUpgradeService; private final IndicesService indicesService; private final ThreadPool threadPool; private final TransportVerifyShardBeforeCloseAction transportVerifyShardBeforeCloseAction; private final ActiveShardsObserver activeShardsObserver; @Inject - public MetaDataIndexStateService(ClusterService clusterService, AllocationService allocationService, - MetaDataIndexUpgradeService metaDataIndexUpgradeService, + public MetadataIndexStateService(ClusterService clusterService, AllocationService allocationService, + MetadataIndexUpgradeService metadataIndexUpgradeService, IndicesService indicesService, ThreadPool threadPool, TransportVerifyShardBeforeCloseAction transportVerifyShardBeforeCloseAction) { this.indicesService = indicesService; @@ -120,7 +120,7 @@ public class MetaDataIndexStateService { this.allocationService = allocationService; this.threadPool = threadPool; this.transportVerifyShardBeforeCloseAction = transportVerifyShardBeforeCloseAction; - this.metaDataIndexUpgradeService = metaDataIndexUpgradeService; + this.metadataIndexUpgradeService = metadataIndexUpgradeService; this.activeShardsObserver = new ActiveShardsObserver(clusterService, threadPool); } @@ -230,12 +230,12 @@ public class MetaDataIndexStateService { */ static ClusterState addIndexClosedBlocks(final Index[] indices, final Map blockedIndices, final ClusterState currentState) { - final MetaData.Builder metadata = MetaData.builder(currentState.metaData()); + final Metadata.Builder metadata = Metadata.builder(currentState.metadata()); final Set indicesToClose = new HashSet<>(); for (Index index : indices) { - final IndexMetaData indexMetaData = metadata.getSafe(index); - if (indexMetaData.getState() != IndexMetaData.State.CLOSE) { + final IndexMetadata indexMetadata = metadata.getSafe(index); + if (indexMetadata.getState() != IndexMetadata.State.CLOSE) { indicesToClose.add(index); } else { logger.debug("index {} is already closed, ignoring", index); @@ -286,7 +286,7 @@ public class MetaDataIndexStateService { logger.info(() -> new ParameterizedMessage("closing indices {}", blockedIndices.keySet().stream().map(Object::toString).collect(Collectors.joining(",")))); - return ClusterState.builder(currentState).blocks(blocks).metaData(metadata).routingTable(routingTable.build()).build(); + return ClusterState.builder(currentState).blocks(blocks).metadata(metadata).routingTable(routingTable.build()).build(); } /** @@ -331,14 +331,14 @@ public class MetaDataIndexStateService { final ClusterBlock closingBlock, final ClusterState state, final Consumer onResponse) { - final IndexMetaData indexMetaData = state.metaData().index(index); - if (indexMetaData == null) { + final IndexMetadata indexMetadata = state.metadata().index(index); + if (indexMetadata == null) { logger.debug("index {} has been blocked before closing and is now deleted, ignoring", index); onResponse.accept(new IndexResult(index)); return; } final IndexRoutingTable indexRoutingTable = state.routingTable().index(index); - if (indexRoutingTable == null || indexMetaData.getState() == IndexMetaData.State.CLOSE) { + if (indexRoutingTable == null || indexMetadata.getState() == IndexMetadata.State.CLOSE) { assert state.blocks().hasIndexBlock(index.getName(), INDEX_CLOSED_BLOCK); logger.debug("index {} has been blocked before closing and is already closed, ignoring", index); onResponse.accept(new IndexResult(index)); @@ -425,7 +425,7 @@ public class MetaDataIndexStateService { // that does not support the replication of closed indices final boolean removeRoutingTable = currentState.nodes().getMinNodeVersion().before(Version.V_7_2_0); - final MetaData.Builder metadata = MetaData.builder(currentState.metaData()); + final Metadata.Builder metadata = Metadata.builder(currentState.metadata()); final ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks()); final RoutingTable.Builder routingTable = RoutingTable.builder(currentState.routingTable()); @@ -439,8 +439,8 @@ public class MetaDataIndexStateService { logger.debug("verification of shards before closing {} failed [{}]", index, result); continue; } - final IndexMetaData indexMetaData = metadata.getSafe(index); - if (indexMetaData.getState() == IndexMetaData.State.CLOSE) { + final IndexMetadata indexMetadata = metadata.getSafe(index); + if (indexMetadata.getState() == IndexMetadata.State.CLOSE) { logger.debug("verification of shards before closing {} succeeded but index is already closed", index); assert currentState.blocks().hasIndexBlock(index.getName(), INDEX_CLOSED_BLOCK); continue; @@ -475,15 +475,15 @@ public class MetaDataIndexStateService { blocks.removeIndexBlockWithId(index.getName(), INDEX_CLOSED_BLOCK_ID); blocks.addIndexBlock(index.getName(), INDEX_CLOSED_BLOCK); - final IndexMetaData.Builder updatedMetaData = IndexMetaData.builder(indexMetaData).state(IndexMetaData.State.CLOSE); + final IndexMetadata.Builder updatedMetadata = IndexMetadata.builder(indexMetadata).state(IndexMetadata.State.CLOSE); if (removeRoutingTable) { - metadata.put(updatedMetaData); + metadata.put(updatedMetadata); routingTable.remove(index.getName()); } else { - metadata.put(updatedMetaData - .settingsVersion(indexMetaData.getSettingsVersion() + 1) + metadata.put(updatedMetadata + .settingsVersion(indexMetadata.getSettingsVersion() + 1) .settings(Settings.builder() - .put(indexMetaData.getSettings()) + .put(indexMetadata.getSettings()) .put(VERIFIED_BEFORE_CLOSE_SETTING.getKey(), true))); routingTable.addAsFromOpenToClose(metadata.getSafe(index)); } @@ -495,7 +495,7 @@ public class MetaDataIndexStateService { } } logger.info("completed closing of indices {}", closedIndices); - return Tuple.tuple(ClusterState.builder(currentState).blocks(blocks).metaData(metadata).routingTable(routingTable.build()).build(), + return Tuple.tuple(ClusterState.builder(currentState).blocks(blocks).metadata(metadata).routingTable(routingTable.build()).build(), closingResults.values()); } @@ -543,13 +543,13 @@ public class MetaDataIndexStateService { } ClusterState openIndices(final Index[] indices, final ClusterState currentState) { - final List indicesToOpen = new ArrayList<>(); + final List indicesToOpen = new ArrayList<>(); for (Index index : indices) { - final IndexMetaData indexMetaData = currentState.metaData().getIndexSafe(index); - if (indexMetaData.getState() != IndexMetaData.State.OPEN) { - indicesToOpen.add(indexMetaData); + final IndexMetadata indexMetadata = currentState.metadata().getIndexSafe(index); + if (indexMetadata.getState() != IndexMetadata.State.OPEN) { + indicesToOpen.add(indexMetadata); } else if (currentState.blocks().hasIndexBlockWithId(index.getName(), INDEX_CLOSED_BLOCK_ID)) { - indicesToOpen.add(indexMetaData); + indicesToOpen.add(indexMetadata); } } @@ -561,43 +561,43 @@ public class MetaDataIndexStateService { logger.info(() -> new ParameterizedMessage("opening indices [{}]", String.join(",", indicesToOpen.stream().map(i -> (CharSequence) i.getIndex().toString())::iterator))); - final MetaData.Builder metadata = MetaData.builder(currentState.metaData()); + final Metadata.Builder metadata = Metadata.builder(currentState.metadata()); final ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks()); final Version minIndexCompatibilityVersion = currentState.getNodes().getMaxNodeVersion().minimumIndexCompatibilityVersion(); - for (IndexMetaData indexMetaData : indicesToOpen) { - final Index index = indexMetaData.getIndex(); - if (indexMetaData.getState() != IndexMetaData.State.OPEN) { - final Settings.Builder updatedSettings = Settings.builder().put(indexMetaData.getSettings()); + for (IndexMetadata indexMetadata : indicesToOpen) { + final Index index = indexMetadata.getIndex(); + if (indexMetadata.getState() != IndexMetadata.State.OPEN) { + final Settings.Builder updatedSettings = Settings.builder().put(indexMetadata.getSettings()); updatedSettings.remove(VERIFIED_BEFORE_CLOSE_SETTING.getKey()); - IndexMetaData updatedIndexMetaData = IndexMetaData.builder(indexMetaData) - .state(IndexMetaData.State.OPEN) - .settingsVersion(indexMetaData.getSettingsVersion() + 1) + IndexMetadata updatedIndexMetadata = IndexMetadata.builder(indexMetadata) + .state(IndexMetadata.State.OPEN) + .settingsVersion(indexMetadata.getSettingsVersion() + 1) .settings(updatedSettings) .build(); // The index might be closed because we couldn't import it due to old incompatible version // We need to check that this index can be upgraded to the current version - updatedIndexMetaData = metaDataIndexUpgradeService.upgradeIndexMetaData(updatedIndexMetaData, minIndexCompatibilityVersion); + updatedIndexMetadata = metadataIndexUpgradeService.upgradeIndexMetadata(updatedIndexMetadata, minIndexCompatibilityVersion); try { - indicesService.verifyIndexMetadata(updatedIndexMetaData, updatedIndexMetaData); + indicesService.verifyIndexMetadata(updatedIndexMetadata, updatedIndexMetadata); } catch (Exception e) { throw new ElasticsearchException("Failed to verify index " + index, e); } - metadata.put(updatedIndexMetaData, true); + metadata.put(updatedIndexMetadata, true); } // Always removes index closed blocks (note: this can fail on-going close index actions) blocks.removeIndexBlockWithId(index.getName(), INDEX_CLOSED_BLOCK_ID); } - ClusterState updatedState = ClusterState.builder(currentState).metaData(metadata).blocks(blocks).build(); + ClusterState updatedState = ClusterState.builder(currentState).metadata(metadata).blocks(blocks).build(); final RoutingTable.Builder routingTable = RoutingTable.builder(updatedState.routingTable()); - for (IndexMetaData previousIndexMetaData : indicesToOpen) { - if (previousIndexMetaData.getState() != IndexMetaData.State.OPEN) { - routingTable.addAsFromCloseToOpen(updatedState.metaData().getIndexSafe(previousIndexMetaData.getIndex())); + for (IndexMetadata previousIndexMetadata : indicesToOpen) { + if (previousIndexMetadata.getState() != IndexMetadata.State.OPEN) { + routingTable.addAsFromCloseToOpen(updatedState.metadata().getIndexSafe(previousIndexMetadata.getIndex())); } } return ClusterState.builder(updatedState).routingTable(routingTable.build()).build(); @@ -613,7 +613,7 @@ public class MetaDataIndexStateService { */ static void validateShardLimit(ClusterState currentState, Index[] indices) { int shardsToOpen = Arrays.stream(indices) - .filter(index -> currentState.metaData().index(index).getState().equals(IndexMetaData.State.CLOSE)) + .filter(index -> currentState.metadata().index(index).getState().equals(IndexMetadata.State.CLOSE)) .mapToInt(index -> getTotalShardCount(currentState, index)) .sum(); @@ -626,8 +626,8 @@ public class MetaDataIndexStateService { } private static int getTotalShardCount(ClusterState state, Index index) { - IndexMetaData indexMetaData = state.metaData().index(index); - return indexMetaData.getNumberOfShards() * (1 + indexMetaData.getNumberOfReplicas()); + IndexMetadata indexMetadata = state.metadata().index(index); + return indexMetadata.getNumberOfShards() * (1 + indexMetadata.getNumberOfReplicas()); } /** @@ -640,9 +640,9 @@ public class MetaDataIndexStateService { EnumSet.of(ClusterBlockLevel.WRITE)); } - public static boolean isIndexVerifiedBeforeClosed(final IndexMetaData indexMetaData) { - return indexMetaData.getState() == IndexMetaData.State.CLOSE - && VERIFIED_BEFORE_CLOSE_SETTING.exists(indexMetaData.getSettings()) - && VERIFIED_BEFORE_CLOSE_SETTING.get(indexMetaData.getSettings()); + public static boolean isIndexVerifiedBeforeClosed(final IndexMetadata indexMetadata) { + return indexMetadata.getState() == IndexMetadata.State.CLOSE + && VERIFIED_BEFORE_CLOSE_SETTING.exists(indexMetadata.getSettings()) + && VERIFIED_BEFORE_CLOSE_SETTING.get(indexMetadata.getSettings()); } } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexTemplateService.java b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateService.java similarity index 89% rename from server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexTemplateService.java rename to server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateService.java index 7b5ca6a8b4c..0fce69ceb1a 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexTemplateService.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateService.java @@ -73,27 +73,27 @@ import static org.elasticsearch.indices.cluster.IndicesClusterStateService.Alloc /** * Service responsible for submitting index templates updates */ -public class MetaDataIndexTemplateService { +public class MetadataIndexTemplateService { - private static final Logger logger = LogManager.getLogger(MetaDataIndexTemplateService.class); + private static final Logger logger = LogManager.getLogger(MetadataIndexTemplateService.class); private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger); private final ClusterService clusterService; private final AliasValidator aliasValidator; private final IndicesService indicesService; - private final MetaDataCreateIndexService metaDataCreateIndexService; + private final MetadataCreateIndexService metadataCreateIndexService; private final IndexScopedSettings indexScopedSettings; private final NamedXContentRegistry xContentRegistry; @Inject - public MetaDataIndexTemplateService(ClusterService clusterService, - MetaDataCreateIndexService metaDataCreateIndexService, + public MetadataIndexTemplateService(ClusterService clusterService, + MetadataCreateIndexService metadataCreateIndexService, AliasValidator aliasValidator, IndicesService indicesService, IndexScopedSettings indexScopedSettings, NamedXContentRegistry xContentRegistry) { this.clusterService = clusterService; this.aliasValidator = aliasValidator; this.indicesService = indicesService; - this.metaDataCreateIndexService = metaDataCreateIndexService; + this.metadataCreateIndexService = metadataCreateIndexService; this.indexScopedSettings = indexScopedSettings; this.xContentRegistry = xContentRegistry; } @@ -114,7 +114,7 @@ public class MetaDataIndexTemplateService { @Override public ClusterState execute(ClusterState currentState) { Set templateNames = new HashSet<>(); - for (ObjectCursor cursor : currentState.metaData().templates().keys()) { + for (ObjectCursor cursor : currentState.metadata().templates().keys()) { String templateName = cursor.value; if (Regex.simpleMatch(request.name, templateName)) { templateNames.add(templateName); @@ -128,12 +128,12 @@ public class MetaDataIndexTemplateService { } throw new IndexTemplateMissingException(request.name); } - MetaData.Builder metaData = MetaData.builder(currentState.metaData()); + Metadata.Builder metadata = Metadata.builder(currentState.metadata()); for (String templateName : templateNames) { logger.info("removing template [{}]", templateName); - metaData.removeTemplate(templateName); + metadata.removeTemplate(templateName); } - return ClusterState.builder(currentState).metaData(metaData).build(); + return ClusterState.builder(currentState).metadata(metadata).build(); } @Override @@ -177,7 +177,7 @@ public class MetaDataIndexTemplateService { // Package visible for testing ClusterState addComponentTemplate(final ClusterState currentState, final boolean create, final String name, final ComponentTemplate template) throws Exception { - if (create && currentState.metaData().componentTemplates().containsKey(name)) { + if (create && currentState.metadata().componentTemplates().containsKey(name)) { throw new IllegalArgumentException("component template [" + name + "] already exists"); } @@ -187,7 +187,7 @@ public class MetaDataIndexTemplateService { logger.info("adding component template [{}]", name); return ClusterState.builder(currentState) - .metaData(MetaData.builder(currentState.metaData()).put(name, template)) + .metadata(Metadata.builder(currentState.metadata()).put(name, template)) .build(); } @@ -213,7 +213,7 @@ public class MetaDataIndexTemplateService { @Override public ClusterState execute(ClusterState currentState) { Set templateNames = new HashSet<>(); - for (String templateName : currentState.metaData().componentTemplates().keySet()) { + for (String templateName : currentState.metadata().componentTemplates().keySet()) { if (Regex.simpleMatch(name, templateName)) { templateNames.add(templateName); } @@ -227,12 +227,12 @@ public class MetaDataIndexTemplateService { // TODO: perhaps introduce a ComponentTemplateMissingException? throw new IndexTemplateMissingException(name); } - MetaData.Builder metaData = MetaData.builder(currentState.metaData()); + Metadata.Builder metadata = Metadata.builder(currentState.metadata()); for (String templateName : templateNames) { logger.info("removing component template [{}]", templateName); - metaData.removeComponentTemplate(templateName); + metadata.removeComponentTemplate(templateName); } - return ClusterState.builder(currentState).metaData(metaData).build(); + return ClusterState.builder(currentState).metadata(metadata).build(); } @Override @@ -276,7 +276,7 @@ public class MetaDataIndexTemplateService { // Package visible for testing static ClusterState addIndexTemplateV2(final ClusterState currentState, final boolean create, final String name, final IndexTemplateV2 template) { - if (create && currentState.metaData().templatesV2().containsKey(name)) { + if (create && currentState.metadata().templatesV2().containsKey(name)) { throw new IllegalArgumentException("index template [" + name + "] already exists"); } @@ -300,7 +300,7 @@ public class MetaDataIndexTemplateService { logger.info("adding index template [{}]", name); return ClusterState.builder(currentState) - .metaData(MetaData.builder(currentState.metaData()).put(name, template)) + .metadata(Metadata.builder(currentState.metadata()).put(name, template)) .build(); } @@ -312,9 +312,9 @@ public class MetaDataIndexTemplateService { final List indexPatterns) { Automaton v2automaton = Regex.simpleMatchToAutomaton(indexPatterns.toArray(Strings.EMPTY_ARRAY)); Map> overlappingTemplates = new HashMap<>(); - for (ObjectObjectCursor cursor : state.metaData().templates()) { + for (ObjectObjectCursor cursor : state.metadata().templates()) { String name = cursor.key; - IndexTemplateMetaData template = cursor.value; + IndexTemplateMetadata template = cursor.value; Automaton v1automaton = Regex.simpleMatchToAutomaton(template.patterns().toArray(Strings.EMPTY_ARRAY)); if (Operations.isEmpty(Operations.intersection(v2automaton, v1automaton)) == false) { logger.debug("index template {} and old template {} would overlap: {} <=> {}", @@ -333,7 +333,7 @@ public class MetaDataIndexTemplateService { final List indexPatterns) { Automaton v1automaton = Regex.simpleMatchToAutomaton(indexPatterns.toArray(Strings.EMPTY_ARRAY)); Map> overlappingTemplates = new HashMap<>(); - for (Map.Entry entry : state.metaData().templatesV2().entrySet()) { + for (Map.Entry entry : state.metadata().templatesV2().entrySet()) { String name = entry.getKey(); IndexTemplateV2 template = entry.getValue(); Automaton v2automaton = Regex.simpleMatchToAutomaton(template.indexPatterns().toArray(Strings.EMPTY_ARRAY)); @@ -380,7 +380,7 @@ public class MetaDataIndexTemplateService { // Package visible for testing static ClusterState innerRemoveIndexTemplateV2(ClusterState currentState, String name) { Set templateNames = new HashSet<>(); - for (String templateName : currentState.metaData().templatesV2().keySet()) { + for (String templateName : currentState.metadata().templatesV2().keySet()) { if (Regex.simpleMatch(name, templateName)) { templateNames.add(templateName); } @@ -393,17 +393,17 @@ public class MetaDataIndexTemplateService { } throw new IndexTemplateMissingException(name); } - MetaData.Builder metaData = MetaData.builder(currentState.metaData()); + Metadata.Builder metadata = Metadata.builder(currentState.metadata()); for (String templateName : templateNames) { logger.info("removing index template [{}]", templateName); - metaData.removeIndexTemplate(templateName); + metadata.removeIndexTemplate(templateName); } - return ClusterState.builder(currentState).metaData(metaData).build(); + return ClusterState.builder(currentState).metadata(metadata).build(); } public void putTemplate(final PutRequest request, final PutListener listener) { Settings.Builder updatedSettingsBuilder = Settings.builder(); - updatedSettingsBuilder.put(request.settings).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX); + updatedSettingsBuilder.put(request.settings).normalizePrefix(IndexMetadata.INDEX_SETTING_PREFIX); request.settings(updatedSettingsBuilder.build()); if (request.name == null) { @@ -422,7 +422,7 @@ public class MetaDataIndexTemplateService { return; } - final IndexTemplateMetaData.Builder templateBuilder = IndexTemplateMetaData.builder(request.name); + final IndexTemplateMetadata.Builder templateBuilder = IndexTemplateMetadata.builder(request.name); clusterService.submitStateUpdateTask("create-index-template [" + request.name + "], cause [" + request.cause + "]", new ClusterStateUpdateTask(Priority.URGENT) { @@ -452,15 +452,15 @@ public class MetaDataIndexTemplateService { // Package visible for testing static ClusterState innerPutTemplate(final ClusterState currentState, PutRequest request, - IndexTemplateMetaData.Builder templateBuilder) { + IndexTemplateMetadata.Builder templateBuilder) { // Flag for whether this is updating an existing template or adding a new one // TODO: in 8.0+, only allow updating index templates, not adding new ones - boolean isUpdate = currentState.metaData().templates().containsKey(request.name); + boolean isUpdate = currentState.metadata().templates().containsKey(request.name); if (request.create && isUpdate) { throw new IllegalArgumentException("index_template [" + request.name + "] already exists"); } boolean isUpdateAndPatternsAreUnchanged = isUpdate && - currentState.metaData().templates().get(request.name).patterns().equals(request.indexPatterns); + currentState.metadata().templates().get(request.name).patterns().equals(request.indexPatterns); Map> overlaps = findConflictingV2Templates(currentState, request.name, request.indexPatterns); if (overlaps.size() > 0) { @@ -507,36 +507,36 @@ public class MetaDataIndexTemplateService { } for (Alias alias : request.aliases) { - AliasMetaData aliasMetaData = AliasMetaData.builder(alias.name()).filter(alias.filter()) + AliasMetadata aliasMetadata = AliasMetadata.builder(alias.name()).filter(alias.filter()) .indexRouting(alias.indexRouting()).searchRouting(alias.searchRouting()).build(); - templateBuilder.putAlias(aliasMetaData); + templateBuilder.putAlias(aliasMetadata); } - IndexTemplateMetaData template = templateBuilder.build(); + IndexTemplateMetadata template = templateBuilder.build(); - MetaData.Builder builder = MetaData.builder(currentState.metaData()).put(template); + Metadata.Builder builder = Metadata.builder(currentState.metadata()).put(template); logger.info("adding template [{}] for index patterns {}", request.name, request.indexPatterns); - return ClusterState.builder(currentState).metaData(builder).build(); + return ClusterState.builder(currentState).metadata(builder).build(); } /** * Finds index templates whose index pattern matched with the given index name. In the case of * hidden indices, a template with a match all pattern or global template will not be returned. * - * @param metaData The {@link MetaData} containing all of the {@link IndexTemplateMetaData} values + * @param metadata The {@link Metadata} containing all of the {@link IndexTemplateMetadata} values * @param indexName The name of the index that templates are being found for * @param isHidden Whether or not the index is known to be hidden. May be {@code null} if the index * being hidden has not been explicitly requested. When {@code null} if the result * of template application results in a hidden index, then global templates will * not be returned - * @return a list of templates sorted by {@link IndexTemplateMetaData#order()} descending. + * @return a list of templates sorted by {@link IndexTemplateMetadata#order()} descending. * */ - public static List findTemplates(MetaData metaData, String indexName, @Nullable Boolean isHidden) { + public static List findTemplates(Metadata metadata, String indexName, @Nullable Boolean isHidden) { final Predicate patternMatchPredicate = pattern -> Regex.simpleMatch(pattern, indexName); - final List matchedTemplates = new ArrayList<>(); - for (ObjectCursor cursor : metaData.templates().values()) { - final IndexTemplateMetaData template = cursor.value; + final List matchedTemplates = new ArrayList<>(); + for (ObjectCursor cursor : metadata.templates().values()) { + final IndexTemplateMetadata template = cursor.value; if (isHidden == null || isHidden == Boolean.FALSE) { final boolean matched = template.patterns().stream().anyMatch(patternMatchPredicate); if (matched) { @@ -552,22 +552,22 @@ public class MetaDataIndexTemplateService { } } } - CollectionUtil.timSort(matchedTemplates, Comparator.comparingInt(IndexTemplateMetaData::order).reversed()); + CollectionUtil.timSort(matchedTemplates, Comparator.comparingInt(IndexTemplateMetadata::order).reversed()); // this is complex but if the index is not hidden in the create request but is hidden as the result of template application, // then we need to exclude global templates if (isHidden == null) { - final Optional templateWithHiddenSetting = matchedTemplates.stream() - .filter(template -> IndexMetaData.INDEX_HIDDEN_SETTING.exists(template.settings())).findFirst(); + final Optional templateWithHiddenSetting = matchedTemplates.stream() + .filter(template -> IndexMetadata.INDEX_HIDDEN_SETTING.exists(template.settings())).findFirst(); if (templateWithHiddenSetting.isPresent()) { - final boolean templatedIsHidden = IndexMetaData.INDEX_HIDDEN_SETTING.get(templateWithHiddenSetting.get().settings()); + final boolean templatedIsHidden = IndexMetadata.INDEX_HIDDEN_SETTING.get(templateWithHiddenSetting.get().settings()); if (templatedIsHidden) { // remove the global templates matchedTemplates.removeIf(current -> current.patterns().stream().anyMatch(Regex::isMatchAllPattern)); } // validate that hidden didn't change - final Optional templateWithHiddenSettingPostRemoval = matchedTemplates.stream() - .filter(template -> IndexMetaData.INDEX_HIDDEN_SETTING.exists(template.settings())).findFirst(); + final Optional templateWithHiddenSettingPostRemoval = matchedTemplates.stream() + .filter(template -> IndexMetadata.INDEX_HIDDEN_SETTING.exists(template.settings())).findFirst(); if (templateWithHiddenSettingPostRemoval.isPresent() == false || templateWithHiddenSetting.get() != templateWithHiddenSettingPostRemoval.get()) { throw new IllegalStateException("A global index template [" + templateWithHiddenSetting.get().name() + @@ -583,7 +583,7 @@ public class MetaDataIndexTemplateService { // First check to see if mappings are valid XContent Map> mappingsForValidation = new HashMap<>(); if (mappings != null) { - IndexTemplateMetaData.Builder templateBuilder = IndexTemplateMetaData.builder("validation"); + IndexTemplateMetadata.Builder templateBuilder = IndexTemplateMetadata.builder("validation"); for (Map.Entry entry : mappings.entrySet()) { if (entry.getValue() != null) { try { @@ -600,22 +600,22 @@ public class MetaDataIndexTemplateService { final String temporaryIndexName = UUIDs.randomBase64UUID(); try { // use the provided values, otherwise just pick valid dummy values - int dummyPartitionSize = IndexMetaData.INDEX_ROUTING_PARTITION_SIZE_SETTING.get(settings); - int dummyShards = settings.getAsInt(IndexMetaData.SETTING_NUMBER_OF_SHARDS, + int dummyPartitionSize = IndexMetadata.INDEX_ROUTING_PARTITION_SIZE_SETTING.get(settings); + int dummyShards = settings.getAsInt(IndexMetadata.SETTING_NUMBER_OF_SHARDS, dummyPartitionSize == 1 ? 1 : dummyPartitionSize + 1); - int shardReplicas = settings.getAsInt(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0); + int shardReplicas = settings.getAsInt(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0); //create index service for parsing and validating "mappings" Settings dummySettings = Settings.builder() - .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + .put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT) .put(settings) - .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, dummyShards) - .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, shardReplicas) - .put(IndexMetaData.SETTING_INDEX_UUID, UUIDs.randomBase64UUID()) + .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, dummyShards) + .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, shardReplicas) + .put(IndexMetadata.SETTING_INDEX_UUID, UUIDs.randomBase64UUID()) .build(); - final IndexMetaData tmpIndexMetadata = IndexMetaData.builder(temporaryIndexName).settings(dummySettings).build(); + final IndexMetadata tmpIndexMetadata = IndexMetadata.builder(temporaryIndexName).settings(dummySettings).build(); IndexService dummyIndexService = indicesService.createIndex(tmpIndexMetadata, Collections.emptyList(), false); createdIndex = dummyIndexService.index(); @@ -671,12 +671,12 @@ public class MetaDataIndexTemplateService { validationErrors.add(t.getMessage()); } } - List indexSettingsValidation = metaDataCreateIndexService.getIndexSettingsValidationErrors(request.settings, true); + List indexSettingsValidation = metadataCreateIndexService.getIndexSettingsValidationErrors(request.settings, true); validationErrors.addAll(indexSettingsValidation); if (request.indexPatterns.stream().anyMatch(Regex::isMatchAllPattern)) { - if (IndexMetaData.INDEX_HIDDEN_SETTING.exists(request.settings)) { - validationErrors.add("global templates may not specify the setting " + IndexMetaData.INDEX_HIDDEN_SETTING.getKey()); + if (IndexMetadata.INDEX_HIDDEN_SETTING.exists(request.settings)) { + validationErrors.add("global templates may not specify the setting " + IndexMetadata.INDEX_HIDDEN_SETTING.getKey()); } } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexUpgradeService.java b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexUpgradeService.java similarity index 81% rename from server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexUpgradeService.java rename to server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexUpgradeService.java index b387349fc5b..8670322b2b9 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexUpgradeService.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexUpgradeService.java @@ -51,16 +51,16 @@ import java.util.Set; * occurs during cluster upgrade, when dangling indices are imported into the cluster or indices * are restored from a repository. */ -public class MetaDataIndexUpgradeService { +public class MetadataIndexUpgradeService { - private static final Logger logger = LogManager.getLogger(MetaDataIndexUpgradeService.class); + private static final Logger logger = LogManager.getLogger(MetadataIndexUpgradeService.class); private final Settings settings; private final NamedXContentRegistry xContentRegistry; private final MapperRegistry mapperRegistry; private final IndexScopedSettings indexScopedSettings; - public MetaDataIndexUpgradeService(Settings settings, NamedXContentRegistry xContentRegistry, MapperRegistry mapperRegistry, + public MetadataIndexUpgradeService(Settings settings, NamedXContentRegistry xContentRegistry, MapperRegistry mapperRegistry, IndexScopedSettings indexScopedSettings) { this.settings = settings; this.xContentRegistry = xContentRegistry; @@ -75,30 +75,30 @@ public class MetaDataIndexUpgradeService { * If the index does not need upgrade it returns the index metadata unchanged, otherwise it returns a modified index metadata. If index * cannot be updated the method throws an exception. */ - public IndexMetaData upgradeIndexMetaData(IndexMetaData indexMetaData, Version minimumIndexCompatibilityVersion) { + public IndexMetadata upgradeIndexMetadata(IndexMetadata indexMetadata, Version minimumIndexCompatibilityVersion) { // Throws an exception if there are too-old segments: - if (isUpgraded(indexMetaData)) { + if (isUpgraded(indexMetadata)) { /* * We still need to check for broken index settings since it might be that a user removed a plugin that registers a setting * needed by this index. */ - return archiveBrokenIndexSettings(indexMetaData); + return archiveBrokenIndexSettings(indexMetadata); } - checkSupportedVersion(indexMetaData, minimumIndexCompatibilityVersion); + checkSupportedVersion(indexMetadata, minimumIndexCompatibilityVersion); // we have to run this first otherwise in we try to create IndexSettings // with broken settings and fail in checkMappingsCompatibility - final IndexMetaData newMetaData = archiveBrokenIndexSettings(indexMetaData); + final IndexMetadata newMetadata = archiveBrokenIndexSettings(indexMetadata); // only run the check with the upgraded settings!! - checkMappingsCompatibility(newMetaData); - return markAsUpgraded(newMetaData); + checkMappingsCompatibility(newMetadata); + return markAsUpgraded(newMetadata); } /** * Checks if the index was already opened by this version of Elasticsearch and doesn't require any additional checks. */ - boolean isUpgraded(IndexMetaData indexMetaData) { - return indexMetaData.getUpgradedVersion().onOrAfter(Version.CURRENT); + boolean isUpgraded(IndexMetadata indexMetadata) { + return indexMetadata.getUpgradedVersion().onOrAfter(Version.CURRENT); } /** @@ -106,11 +106,11 @@ public class MetaDataIndexUpgradeService { * that were created before Elasticsearch v5.0 should be re-indexed in Elasticsearch 5.x * before they can be opened by this version of elasticsearch. */ - private void checkSupportedVersion(IndexMetaData indexMetaData, Version minimumIndexCompatibilityVersion) { - if (indexMetaData.getState() == IndexMetaData.State.OPEN && isSupportedVersion(indexMetaData, + private void checkSupportedVersion(IndexMetadata indexMetadata, Version minimumIndexCompatibilityVersion) { + if (indexMetadata.getState() == IndexMetadata.State.OPEN && isSupportedVersion(indexMetadata, minimumIndexCompatibilityVersion) == false) { - throw new IllegalStateException("The index [" + indexMetaData.getIndex() + "] was created with version [" - + indexMetaData.getCreationVersion() + "] but the minimum compatible version is [" + throw new IllegalStateException("The index [" + indexMetadata.getIndex() + "] was created with version [" + + indexMetadata.getCreationVersion() + "] but the minimum compatible version is [" + minimumIndexCompatibilityVersion + "]. It should be re-indexed in Elasticsearch " + minimumIndexCompatibilityVersion.major + ".x before upgrading to " + Version.CURRENT + "."); @@ -120,14 +120,14 @@ public class MetaDataIndexUpgradeService { /* * Returns true if this index can be supported by the current version of elasticsearch */ - private static boolean isSupportedVersion(IndexMetaData indexMetaData, Version minimumIndexCompatibilityVersion) { - return indexMetaData.getCreationVersion().onOrAfter(minimumIndexCompatibilityVersion); + private static boolean isSupportedVersion(IndexMetadata indexMetadata, Version minimumIndexCompatibilityVersion) { + return indexMetadata.getCreationVersion().onOrAfter(minimumIndexCompatibilityVersion); } /** * Checks the mappings for compatibility with the current version */ - private void checkMappingsCompatibility(IndexMetaData indexMetaData) { + private void checkMappingsCompatibility(IndexMetadata indexMetadata) { try { // We cannot instantiate real analysis server or similarity service at this point because the node @@ -137,7 +137,7 @@ public class MetaDataIndexUpgradeService { // Missing analyzers and similarities plugin will still trigger the appropriate error during the // actual upgrade. - IndexSettings indexSettings = new IndexSettings(indexMetaData, this.settings); + IndexSettings indexSettings = new IndexSettings(indexMetadata, this.settings); final Map> similarityMap = new AbstractMap>() { @@ -185,35 +185,35 @@ public class MetaDataIndexUpgradeService { new IndexAnalyzers(analyzerMap, analyzerMap, analyzerMap)) { MapperService mapperService = new MapperService(indexSettings, fakeIndexAnalzyers, xContentRegistry, similarityService, mapperRegistry, () -> null, () -> false); - mapperService.merge(indexMetaData, MapperService.MergeReason.MAPPING_RECOVERY); + mapperService.merge(indexMetadata, MapperService.MergeReason.MAPPING_RECOVERY); } } catch (Exception ex) { // Wrap the inner exception so we have the index name in the exception message - throw new IllegalStateException("unable to upgrade the mappings for the index [" + indexMetaData.getIndex() + "]", ex); + throw new IllegalStateException("unable to upgrade the mappings for the index [" + indexMetadata.getIndex() + "]", ex); } } /** * Marks index as upgraded so we don't have to test it again */ - private IndexMetaData markAsUpgraded(IndexMetaData indexMetaData) { - Settings settings = Settings.builder().put(indexMetaData.getSettings()) - .put(IndexMetaData.SETTING_VERSION_UPGRADED, Version.CURRENT).build(); - return IndexMetaData.builder(indexMetaData).settings(settings).build(); + private IndexMetadata markAsUpgraded(IndexMetadata indexMetadata) { + Settings settings = Settings.builder().put(indexMetadata.getSettings()) + .put(IndexMetadata.SETTING_VERSION_UPGRADED, Version.CURRENT).build(); + return IndexMetadata.builder(indexMetadata).settings(settings).build(); } - IndexMetaData archiveBrokenIndexSettings(IndexMetaData indexMetaData) { - final Settings settings = indexMetaData.getSettings(); + IndexMetadata archiveBrokenIndexSettings(IndexMetadata indexMetadata) { + final Settings settings = indexMetadata.getSettings(); final Settings upgrade = indexScopedSettings.archiveUnknownOrInvalidSettings( settings, e -> logger.warn("{} ignoring unknown index setting: [{}] with value [{}]; archiving", - indexMetaData.getIndex(), e.getKey(), e.getValue()), + indexMetadata.getIndex(), e.getKey(), e.getValue()), (e, ex) -> logger.warn(() -> new ParameterizedMessage("{} ignoring invalid index setting: [{}] with value [{}]; archiving", - indexMetaData.getIndex(), e.getKey(), e.getValue()), ex)); + indexMetadata.getIndex(), e.getKey(), e.getValue()), ex)); if (upgrade != settings) { - return IndexMetaData.builder(indexMetaData).settings(upgrade).build(); + return IndexMetadata.builder(indexMetadata).settings(upgrade).build(); } else { - return indexMetaData; + return indexMetadata; } } } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataMappingService.java b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataMappingService.java similarity index 90% rename from server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataMappingService.java rename to server/src/main/java/org/elasticsearch/cluster/metadata/MetadataMappingService.java index e5ee59adf2e..faa37d53ec4 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataMappingService.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataMappingService.java @@ -60,9 +60,9 @@ import static org.elasticsearch.indices.cluster.IndicesClusterStateService.Alloc /** * Service responsible for submitting mapping changes */ -public class MetaDataMappingService { +public class MetadataMappingService { - private static final Logger logger = LogManager.getLogger(MetaDataMappingService.class); + private static final Logger logger = LogManager.getLogger(MetadataMappingService.class); private final ClusterService clusterService; private final IndicesService indicesService; @@ -72,7 +72,7 @@ public class MetaDataMappingService { @Inject - public MetaDataMappingService(ClusterService clusterService, IndicesService indicesService) { + public MetadataMappingService(ClusterService clusterService, IndicesService indicesService) { this.clusterService = clusterService; this.indicesService = indicesService; } @@ -117,22 +117,22 @@ public class MetaDataMappingService { } boolean dirty = false; - MetaData.Builder mdBuilder = MetaData.builder(currentState.metaData()); + Metadata.Builder mdBuilder = Metadata.builder(currentState.metadata()); for (Map.Entry> entry : tasksPerIndex.entrySet()) { - IndexMetaData indexMetaData = mdBuilder.get(entry.getKey()); - if (indexMetaData == null) { + IndexMetadata indexMetadata = mdBuilder.get(entry.getKey()); + if (indexMetadata == null) { // index got deleted on us, ignore... logger.debug("[{}] ignoring tasks - index meta data doesn't exist", entry.getKey()); continue; } - final Index index = indexMetaData.getIndex(); + final Index index = indexMetadata.getIndex(); // the tasks lists to iterate over, filled with the list of mapping tasks, trying to keep // the latest (based on order) update mapping one per node List allIndexTasks = entry.getValue(); boolean hasTaskWithRightUUID = false; for (RefreshTask task : allIndexTasks) { - if (indexMetaData.isSameUUID(task.indexUUID)) { + if (indexMetadata.isSameUUID(task.indexUUID)) { hasTaskWithRightUUID = true; } else { logger.debug("{} ignoring task [{}] - index meta data doesn't match task uuid", index, task); @@ -144,15 +144,15 @@ public class MetaDataMappingService { // construct the actual index if needed, and make sure the relevant mappings are there boolean removeIndex = false; - IndexService indexService = indicesService.indexService(indexMetaData.getIndex()); + IndexService indexService = indicesService.indexService(indexMetadata.getIndex()); if (indexService == null) { // we need to create the index here, and add the current mapping to it, so we can merge - indexService = indicesService.createIndex(indexMetaData, Collections.emptyList(), false); + indexService = indicesService.createIndex(indexMetadata, Collections.emptyList(), false); removeIndex = true; - indexService.mapperService().merge(indexMetaData, MergeReason.MAPPING_RECOVERY); + indexService.mapperService().merge(indexMetadata, MergeReason.MAPPING_RECOVERY); } - IndexMetaData.Builder builder = IndexMetaData.builder(indexMetaData); + IndexMetadata.Builder builder = IndexMetadata.builder(indexMetadata); try { boolean indexDirty = refreshIndexMapping(indexService, builder); if (indexDirty) { @@ -169,10 +169,10 @@ public class MetaDataMappingService { if (!dirty) { return currentState; } - return ClusterState.builder(currentState).metaData(mdBuilder).build(); + return ClusterState.builder(currentState).metadata(mdBuilder).build(); } - private boolean refreshIndexMapping(IndexService indexService, IndexMetaData.Builder builder) { + private boolean refreshIndexMapping(IndexService indexService, IndexMetadata.Builder builder) { boolean dirty = false; String index = indexService.index().getName(); try { @@ -195,7 +195,7 @@ public class MetaDataMappingService { for (DocumentMapper mapper : Arrays.asList(mapperService.documentMapper(), mapperService.documentMapper(MapperService.DEFAULT_MAPPING))) { if (mapper != null) { - builder.putMapping(new MappingMetaData(mapper)); + builder.putMapping(new MappingMetadata(mapper)); } } } @@ -228,12 +228,12 @@ public class MetaDataMappingService { for (PutMappingClusterStateUpdateRequest request : tasks) { try { for (Index index : request.indices()) { - final IndexMetaData indexMetaData = currentState.metaData().getIndexSafe(index); - if (indexMapperServices.containsKey(indexMetaData.getIndex()) == false) { - MapperService mapperService = indicesService.createIndexMapperService(indexMetaData); + final IndexMetadata indexMetadata = currentState.metadata().getIndexSafe(index); + if (indexMapperServices.containsKey(indexMetadata.getIndex()) == false) { + MapperService mapperService = indicesService.createIndexMapperService(indexMetadata); indexMapperServices.put(index, mapperService); // add mappings for all types, we need them for cross-type validation - mapperService.merge(indexMetaData, MergeReason.MAPPING_RECOVERY); + mapperService.merge(indexMetadata, MergeReason.MAPPING_RECOVERY); } } currentState = applyRequest(currentState, request, indexMapperServices); @@ -252,17 +252,17 @@ public class MetaDataMappingService { Map indexMapperServices) throws IOException { String mappingType = request.type(); CompressedXContent mappingUpdateSource = new CompressedXContent(request.source()); - final MetaData metaData = currentState.metaData(); - final List updateList = new ArrayList<>(); + final Metadata metadata = currentState.metadata(); + final List updateList = new ArrayList<>(); for (Index index : request.indices()) { MapperService mapperService = indexMapperServices.get(index); // IMPORTANT: always get the metadata from the state since it get's batched // and if we pull it from the indexService we might miss an update etc. - final IndexMetaData indexMetaData = currentState.getMetaData().getIndexSafe(index); + final IndexMetadata indexMetadata = currentState.getMetadata().getIndexSafe(index); // this is paranoia... just to be sure we use the exact same metadata tuple on the update that // we used for the validation, it makes this mechanism little less scary (a little) - updateList.add(indexMetaData); + updateList.add(indexMetadata); // try and parse it (no need to add it here) so we can bail early in case of parsing exception DocumentMapper newMapper; DocumentMapper existingMapper = mapperService.documentMapper(); @@ -298,13 +298,13 @@ public class MetaDataMappingService { && mappingType.charAt(0) == '_') { throw new InvalidTypeNameException("Document mapping type name can't start with '_', found: [" + mappingType + "]"); } - MetaData.Builder builder = MetaData.builder(metaData); + Metadata.Builder builder = Metadata.builder(metadata); boolean updated = false; - for (IndexMetaData indexMetaData : updateList) { + for (IndexMetadata indexMetadata : updateList) { boolean updatedMapping = false; // do the actual merge here on the master, and update the mapping source // we use the exact same indexService and metadata we used to validate above here to actually apply the update - final Index index = indexMetaData.getIndex(); + final Index index = indexMetadata.getIndex(); final MapperService mapperService = indexMapperServices.get(index); String typeForUpdate = mapperService.getTypeForUpdate(mappingType, mappingUpdateSource); @@ -338,28 +338,28 @@ public class MetaDataMappingService { } } - IndexMetaData.Builder indexMetaDataBuilder = IndexMetaData.builder(indexMetaData); + IndexMetadata.Builder indexMetadataBuilder = IndexMetadata.builder(indexMetadata); // Mapping updates on a single type may have side-effects on other types so we need to // update mapping metadata on all types for (DocumentMapper mapper : Arrays.asList(mapperService.documentMapper(), mapperService.documentMapper(MapperService.DEFAULT_MAPPING))) { if (mapper != null) { - indexMetaDataBuilder.putMapping(new MappingMetaData(mapper.mappingSource())); + indexMetadataBuilder.putMapping(new MappingMetadata(mapper.mappingSource())); } } if (updatedMapping) { - indexMetaDataBuilder.mappingVersion(1 + indexMetaDataBuilder.mappingVersion()); + indexMetadataBuilder.mappingVersion(1 + indexMetadataBuilder.mappingVersion()); } /* * This implicitly increments the index metadata version and builds the index metadata. This means that we need to have * already incremented the mapping version if necessary. Therefore, the mapping version increment must remain before this * statement. */ - builder.put(indexMetaDataBuilder); + builder.put(indexMetadataBuilder); updated |= updatedMapping; } if (updated) { - return ClusterState.builder(currentState).metaData(builder).build(); + return ClusterState.builder(currentState).metadata(builder).build(); } else { return currentState; } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataUpdateSettingsService.java similarity index 80% rename from server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java rename to server/src/main/java/org/elasticsearch/cluster/metadata/MetadataUpdateSettingsService.java index aa1d894933c..d0bac87dfff 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataUpdateSettingsService.java @@ -61,8 +61,8 @@ import static org.elasticsearch.index.IndexSettings.same; /** * Service responsible for submitting update index settings requests */ -public class MetaDataUpdateSettingsService { - private static final Logger logger = LogManager.getLogger(MetaDataUpdateSettingsService.class); +public class MetadataUpdateSettingsService { + private static final Logger logger = LogManager.getLogger(MetadataUpdateSettingsService.class); private final ClusterService clusterService; @@ -73,7 +73,7 @@ public class MetaDataUpdateSettingsService { private final ThreadPool threadPool; @Inject - public MetaDataUpdateSettingsService(ClusterService clusterService, AllocationService allocationService, + public MetadataUpdateSettingsService(ClusterService clusterService, AllocationService allocationService, IndexScopedSettings indexScopedSettings, IndicesService indicesService, ThreadPool threadPool) { this.clusterService = clusterService; this.threadPool = threadPool; @@ -85,7 +85,7 @@ public class MetaDataUpdateSettingsService { public void updateSettings(final UpdateSettingsClusterStateUpdateRequest request, final ActionListener listener) { final Settings normalizedSettings = - Settings.builder().put(request.settings()).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX).build(); + Settings.builder().put(request.settings()).normalizePrefix(IndexMetadata.INDEX_SETTING_PREFIX).build(); Settings.Builder settingsForClosedIndices = Settings.builder(); Settings.Builder settingsForOpenIndices = Settings.builder(); final Set skippedSettings = new HashSet<>(); @@ -124,7 +124,7 @@ public class MetaDataUpdateSettingsService { public ClusterState execute(ClusterState currentState) { RoutingTable.Builder routingTableBuilder = RoutingTable.builder(currentState.routingTable()); - MetaData.Builder metaDataBuilder = MetaData.builder(currentState.metaData()); + Metadata.Builder metadataBuilder = Metadata.builder(currentState.metadata()); // allow to change any settings to a close index, and only allow dynamic settings to be changed // on an open index @@ -134,8 +134,8 @@ public class MetaDataUpdateSettingsService { for (int i = 0; i < request.indices().length; i++) { Index index = request.indices()[i]; actualIndices[i] = index.getName(); - final IndexMetaData metaData = currentState.metaData().getIndexSafe(index); - if (metaData.getState() == IndexMetaData.State.OPEN) { + final IndexMetadata metadata = currentState.metadata().getIndexSafe(index); + if (metadata.getState() == IndexMetadata.State.OPEN) { openIndices.add(index); } else { closeIndices.add(index); @@ -147,7 +147,7 @@ public class MetaDataUpdateSettingsService { "Can't update non dynamic settings [%s] for open indices %s", skippedSettings, openIndices)); } - int updatedNumberOfReplicas = openSettings.getAsInt(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, -1); + int updatedNumberOfReplicas = openSettings.getAsInt(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, -1); if (updatedNumberOfReplicas != -1 && preserveExisting == false) { // Verify that this won't take us over the cluster shard limit. @@ -165,52 +165,52 @@ public class MetaDataUpdateSettingsService { // operation which make these copies stale // TODO: update the list once the data is deleted by the node? routingTableBuilder.updateNumberOfReplicas(updatedNumberOfReplicas, actualIndices); - metaDataBuilder.updateNumberOfReplicas(updatedNumberOfReplicas, actualIndices); + metadataBuilder.updateNumberOfReplicas(updatedNumberOfReplicas, actualIndices); logger.info("updating number_of_replicas to [{}] for indices {}", updatedNumberOfReplicas, actualIndices); } ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks()); - maybeUpdateClusterBlock(actualIndices, blocks, IndexMetaData.INDEX_READ_ONLY_BLOCK, - IndexMetaData.INDEX_READ_ONLY_SETTING, openSettings); - maybeUpdateClusterBlock(actualIndices, blocks, IndexMetaData.INDEX_READ_ONLY_ALLOW_DELETE_BLOCK, - IndexMetaData.INDEX_BLOCKS_READ_ONLY_ALLOW_DELETE_SETTING, openSettings); - maybeUpdateClusterBlock(actualIndices, blocks, IndexMetaData.INDEX_METADATA_BLOCK, - IndexMetaData.INDEX_BLOCKS_METADATA_SETTING, openSettings); - maybeUpdateClusterBlock(actualIndices, blocks, IndexMetaData.INDEX_WRITE_BLOCK, - IndexMetaData.INDEX_BLOCKS_WRITE_SETTING, openSettings); - maybeUpdateClusterBlock(actualIndices, blocks, IndexMetaData.INDEX_READ_BLOCK, - IndexMetaData.INDEX_BLOCKS_READ_SETTING, openSettings); + maybeUpdateClusterBlock(actualIndices, blocks, IndexMetadata.INDEX_READ_ONLY_BLOCK, + IndexMetadata.INDEX_READ_ONLY_SETTING, openSettings); + maybeUpdateClusterBlock(actualIndices, blocks, IndexMetadata.INDEX_READ_ONLY_ALLOW_DELETE_BLOCK, + IndexMetadata.INDEX_BLOCKS_READ_ONLY_ALLOW_DELETE_SETTING, openSettings); + maybeUpdateClusterBlock(actualIndices, blocks, IndexMetadata.INDEX_METADATA_BLOCK, + IndexMetadata.INDEX_BLOCKS_METADATA_SETTING, openSettings); + maybeUpdateClusterBlock(actualIndices, blocks, IndexMetadata.INDEX_WRITE_BLOCK, + IndexMetadata.INDEX_BLOCKS_WRITE_SETTING, openSettings); + maybeUpdateClusterBlock(actualIndices, blocks, IndexMetadata.INDEX_READ_BLOCK, + IndexMetadata.INDEX_BLOCKS_READ_SETTING, openSettings); if (!openIndices.isEmpty()) { for (Index index : openIndices) { - IndexMetaData indexMetaData = metaDataBuilder.getSafe(index); + IndexMetadata indexMetadata = metadataBuilder.getSafe(index); Settings.Builder updates = Settings.builder(); - Settings.Builder indexSettings = Settings.builder().put(indexMetaData.getSettings()); + Settings.Builder indexSettings = Settings.builder().put(indexMetadata.getSettings()); if (indexScopedSettings.updateDynamicSettings(openSettings, indexSettings, updates, index.getName())) { if (preserveExisting) { - indexSettings.put(indexMetaData.getSettings()); + indexSettings.put(indexMetadata.getSettings()); } Settings finalSettings = indexSettings.build(); indexScopedSettings.validate( finalSettings.filter(k -> indexScopedSettings.isPrivateSetting(k) == false), true); - metaDataBuilder.put(IndexMetaData.builder(indexMetaData).settings(finalSettings)); + metadataBuilder.put(IndexMetadata.builder(indexMetadata).settings(finalSettings)); } } } if (!closeIndices.isEmpty()) { for (Index index : closeIndices) { - IndexMetaData indexMetaData = metaDataBuilder.getSafe(index); + IndexMetadata indexMetadata = metadataBuilder.getSafe(index); Settings.Builder updates = Settings.builder(); - Settings.Builder indexSettings = Settings.builder().put(indexMetaData.getSettings()); + Settings.Builder indexSettings = Settings.builder().put(indexMetadata.getSettings()); if (indexScopedSettings.updateSettings(closedSettings, indexSettings, updates, index.getName())) { if (preserveExisting) { - indexSettings.put(indexMetaData.getSettings()); + indexSettings.put(indexMetadata.getSettings()); } Settings finalSettings = indexSettings.build(); indexScopedSettings.validate( finalSettings.filter(k -> indexScopedSettings.isPrivateSetting(k) == false), true); - metaDataBuilder.put(IndexMetaData.builder(indexMetaData).settings(finalSettings)); + metadataBuilder.put(IndexMetadata.builder(indexMetadata).settings(finalSettings)); } } } @@ -218,37 +218,37 @@ public class MetaDataUpdateSettingsService { if (IndexSettings.INDEX_TRANSLOG_RETENTION_AGE_SETTING.exists(normalizedSettings) || IndexSettings.INDEX_TRANSLOG_RETENTION_SIZE_SETTING.exists(normalizedSettings)) { for (String index : actualIndices) { - MetaDataCreateIndexService.validateTranslogRetentionSettings(metaDataBuilder.get(index).getSettings()); + MetadataCreateIndexService.validateTranslogRetentionSettings(metadataBuilder.get(index).getSettings()); } } // increment settings versions for (final String index : actualIndices) { - if (same(currentState.metaData().index(index).getSettings(), metaDataBuilder.get(index).getSettings()) == false) { - final IndexMetaData.Builder builder = IndexMetaData.builder(metaDataBuilder.get(index)); + if (same(currentState.metadata().index(index).getSettings(), metadataBuilder.get(index).getSettings()) == false) { + final IndexMetadata.Builder builder = IndexMetadata.builder(metadataBuilder.get(index)); builder.settingsVersion(1 + builder.settingsVersion()); - metaDataBuilder.put(builder); + metadataBuilder.put(builder); } } - ClusterState updatedState = ClusterState.builder(currentState).metaData(metaDataBuilder) + ClusterState updatedState = ClusterState.builder(currentState).metadata(metadataBuilder) .routingTable(routingTableBuilder.build()).blocks(blocks).build(); // now, reroute in case things change that require it (like number of replicas) updatedState = allocationService.reroute(updatedState, "settings update"); try { for (Index index : openIndices) { - final IndexMetaData currentMetaData = currentState.getMetaData().getIndexSafe(index); - final IndexMetaData updatedMetaData = updatedState.metaData().getIndexSafe(index); - indicesService.verifyIndexMetadata(currentMetaData, updatedMetaData); + final IndexMetadata currentMetadata = currentState.getMetadata().getIndexSafe(index); + final IndexMetadata updatedMetadata = updatedState.metadata().getIndexSafe(index); + indicesService.verifyIndexMetadata(currentMetadata, updatedMetadata); } for (Index index : closeIndices) { - final IndexMetaData currentMetaData = currentState.getMetaData().getIndexSafe(index); - final IndexMetaData updatedMetaData = updatedState.metaData().getIndexSafe(index); + final IndexMetadata currentMetadata = currentState.getMetadata().getIndexSafe(index); + final IndexMetadata updatedMetadata = updatedState.metadata().getIndexSafe(index); // Verifies that the current index settings can be updated with the updated dynamic settings. - indicesService.verifyIndexMetadata(currentMetaData, updatedMetaData); + indicesService.verifyIndexMetadata(currentMetadata, updatedMetadata); // Now check that we can create the index with the updated settings (dynamic and non-dynamic). // This step is mandatory since we allow to update non-dynamic settings on closed indices. - indicesService.verifyIndexMetadata(updatedMetaData, updatedMetaData); + indicesService.verifyIndexMetadata(updatedMetadata, updatedMetadata); } } catch (IOException ex) { throw ExceptionsHelper.convertToElastic(ex); @@ -259,9 +259,9 @@ public class MetaDataUpdateSettingsService { } private int getTotalNewShards(Index index, ClusterState currentState, int updatedNumberOfReplicas) { - IndexMetaData indexMetaData = currentState.metaData().index(index); - int shardsInIndex = indexMetaData.getNumberOfShards(); - int oldNumberOfReplicas = indexMetaData.getNumberOfReplicas(); + IndexMetadata indexMetadata = currentState.metadata().index(index); + int shardsInIndex = indexMetadata.getNumberOfShards(); + int oldNumberOfReplicas = indexMetadata.getNumberOfReplicas(); int replicaIncrease = updatedNumberOfReplicas - oldNumberOfReplicas; return replicaIncrease * shardsInIndex; } @@ -297,26 +297,26 @@ public class MetaDataUpdateSettingsService { @Override public ClusterState execute(ClusterState currentState) { - MetaData.Builder metaDataBuilder = MetaData.builder(currentState.metaData()); + Metadata.Builder metadataBuilder = Metadata.builder(currentState.metadata()); for (Map.Entry> entry : request.versions().entrySet()) { String index = entry.getKey(); - IndexMetaData indexMetaData = metaDataBuilder.get(index); - if (indexMetaData != null) { - if (Version.CURRENT.equals(indexMetaData.getCreationVersion()) == false) { + IndexMetadata indexMetadata = metadataBuilder.get(index); + if (indexMetadata != null) { + if (Version.CURRENT.equals(indexMetadata.getCreationVersion()) == false) { // no reason to pollute the settings, we didn't really upgrade anything - metaDataBuilder.put( - IndexMetaData - .builder(indexMetaData) + metadataBuilder.put( + IndexMetadata + .builder(indexMetadata) .settings( Settings .builder() - .put(indexMetaData.getSettings()) - .put(IndexMetaData.SETTING_VERSION_UPGRADED, entry.getValue().v1())) - .settingsVersion(1 + indexMetaData.getSettingsVersion())); + .put(indexMetadata.getSettings()) + .put(IndexMetadata.SETTING_VERSION_UPGRADED, entry.getValue().v1())) + .settingsVersion(1 + indexMetadata.getSettingsVersion())); } } } - return ClusterState.builder(currentState).metaData(metaDataBuilder).build(); + return ClusterState.builder(currentState).metadata(metadataBuilder).build(); } }); } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/RepositoriesMetaData.java b/server/src/main/java/org/elasticsearch/cluster/metadata/RepositoriesMetadata.java similarity index 85% rename from server/src/main/java/org/elasticsearch/cluster/metadata/RepositoriesMetaData.java rename to server/src/main/java/org/elasticsearch/cluster/metadata/RepositoriesMetadata.java index 0abe6864e84..2805981ed31 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/RepositoriesMetaData.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/RepositoriesMetadata.java @@ -23,7 +23,7 @@ import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.Version; import org.elasticsearch.cluster.AbstractNamedDiffable; import org.elasticsearch.cluster.NamedDiff; -import org.elasticsearch.cluster.metadata.MetaData.Custom; +import org.elasticsearch.cluster.metadata.Metadata.Custom; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.stream.StreamInput; @@ -44,24 +44,24 @@ import java.util.List; /** * Contains metadata about registered snapshot repositories */ -public class RepositoriesMetaData extends AbstractNamedDiffable implements Custom { +public class RepositoriesMetadata extends AbstractNamedDiffable implements Custom { public static final String TYPE = "repositories"; /** - * Serialization parameter used to hide the {@link RepositoryMetaData#generation()} and {@link RepositoryMetaData#pendingGeneration()} + * Serialization parameter used to hide the {@link RepositoryMetadata#generation()} and {@link RepositoryMetadata#pendingGeneration()} * in {@link org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse}. */ public static final String HIDE_GENERATIONS_PARAM = "hide_generations"; - private final List repositories; + private final List repositories; /** * Constructs new repository metadata * * @param repositories list of repositories */ - public RepositoriesMetaData(List repositories) { + public RepositoriesMetadata(List repositories) { this.repositories = Collections.unmodifiableList(repositories); } @@ -73,7 +73,7 @@ public class RepositoriesMetaData extends AbstractNamedDiffable implemen * @param pendingGeneration new pending generation * @return new instance with updated generations */ - public RepositoriesMetaData withUpdatedGeneration(String repoName, long safeGeneration, long pendingGeneration) { + public RepositoriesMetadata withUpdatedGeneration(String repoName, long safeGeneration, long pendingGeneration) { int indexOfRepo = -1; for (int i = 0; i < repositories.size(); i++) { if (repositories.get(i).name().equals(repoName)) { @@ -84,9 +84,9 @@ public class RepositoriesMetaData extends AbstractNamedDiffable implemen if (indexOfRepo < 0) { throw new IllegalArgumentException("Unknown repository [" + repoName + "]"); } - final List updatedRepos = new ArrayList<>(repositories); - updatedRepos.set(indexOfRepo, new RepositoryMetaData(repositories.get(indexOfRepo), safeGeneration, pendingGeneration)); - return new RepositoriesMetaData(updatedRepos); + final List updatedRepos = new ArrayList<>(repositories); + updatedRepos.set(indexOfRepo, new RepositoryMetadata(repositories.get(indexOfRepo), safeGeneration, pendingGeneration)); + return new RepositoriesMetadata(updatedRepos); } /** @@ -94,7 +94,7 @@ public class RepositoriesMetaData extends AbstractNamedDiffable implemen * * @return list of repositories */ - public List repositories() { + public List repositories() { return this.repositories; } @@ -104,8 +104,8 @@ public class RepositoriesMetaData extends AbstractNamedDiffable implemen * @param name name of repository * @return repository metadata */ - public RepositoryMetaData repository(String name) { - for (RepositoryMetaData repository : repositories) { + public RepositoryMetadata repository(String name) { + for (RepositoryMetadata repository : repositories) { if (name.equals(repository.name())) { return repository; } @@ -118,20 +118,20 @@ public class RepositoriesMetaData extends AbstractNamedDiffable implemen if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - RepositoriesMetaData that = (RepositoriesMetaData) o; + RepositoriesMetadata that = (RepositoriesMetadata) o; return repositories.equals(that.repositories); } /** * Checks if this instance and the given instance share the same repositories by checking that this instances' repositories and the - * repositories in {@code other} are equal or only differ in their values of {@link RepositoryMetaData#generation()} and - * {@link RepositoryMetaData#pendingGeneration()}. + * repositories in {@code other} are equal or only differ in their values of {@link RepositoryMetadata#generation()} and + * {@link RepositoryMetadata#pendingGeneration()}. * * @param other other repositories metadata * @return {@code true} iff both instances contain the same repositories apart from differences in generations */ - public boolean equalsIgnoreGenerations(@Nullable RepositoriesMetaData other) { + public boolean equalsIgnoreGenerations(@Nullable RepositoriesMetadata other) { if (other == null) { return false; } @@ -164,10 +164,10 @@ public class RepositoriesMetaData extends AbstractNamedDiffable implemen return Version.CURRENT.minimumCompatibilityVersion(); } - public RepositoriesMetaData(StreamInput in) throws IOException { - RepositoryMetaData[] repository = new RepositoryMetaData[in.readVInt()]; + public RepositoriesMetadata(StreamInput in) throws IOException { + RepositoryMetadata[] repository = new RepositoryMetadata[in.readVInt()]; for (int i = 0; i < repository.length; i++) { - repository[i] = new RepositoryMetaData(in); + repository[i] = new RepositoryMetadata(in); } this.repositories = Collections.unmodifiableList(Arrays.asList(repository)); } @@ -182,14 +182,14 @@ public class RepositoriesMetaData extends AbstractNamedDiffable implemen @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(repositories.size()); - for (RepositoryMetaData repository : repositories) { + for (RepositoryMetadata repository : repositories) { repository.writeTo(out); } } - public static RepositoriesMetaData fromXContent(XContentParser parser) throws IOException { + public static RepositoriesMetadata fromXContent(XContentParser parser) throws IOException { XContentParser.Token token; - List repository = new ArrayList<>(); + List repository = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { if (token == XContentParser.Token.FIELD_NAME) { String name = parser.currentName(); @@ -234,12 +234,12 @@ public class RepositoriesMetaData extends AbstractNamedDiffable implemen if (type == null) { throw new ElasticsearchParseException("failed to parse repository [{}], missing repository type", name); } - repository.add(new RepositoryMetaData(name, type, settings, generation, pendingGeneration)); + repository.add(new RepositoryMetadata(name, type, settings, generation, pendingGeneration)); } else { throw new ElasticsearchParseException("failed to parse repositories"); } } - return new RepositoriesMetaData(repository); + return new RepositoriesMetadata(repository); } /** @@ -247,15 +247,15 @@ public class RepositoriesMetaData extends AbstractNamedDiffable implemen */ @Override public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException { - for (RepositoryMetaData repository : repositories) { + for (RepositoryMetadata repository : repositories) { toXContent(repository, builder, params); } return builder; } @Override - public EnumSet context() { - return MetaData.API_AND_GATEWAY; + public EnumSet context() { + return Metadata.API_AND_GATEWAY; } /** @@ -265,7 +265,7 @@ public class RepositoriesMetaData extends AbstractNamedDiffable implemen * @param builder XContent builder * @param params serialization parameters */ - public static void toXContent(RepositoryMetaData repository, XContentBuilder builder, ToXContent.Params params) throws IOException { + public static void toXContent(RepositoryMetadata repository, XContentBuilder builder, ToXContent.Params params) throws IOException { builder.startObject(repository.name()); builder.field("type", repository.type()); builder.startObject("settings"); diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/RepositoryMetaData.java b/server/src/main/java/org/elasticsearch/cluster/metadata/RepositoryMetadata.java similarity index 91% rename from server/src/main/java/org/elasticsearch/cluster/metadata/RepositoryMetaData.java rename to server/src/main/java/org/elasticsearch/cluster/metadata/RepositoryMetadata.java index c57f7028055..57c54f73bc5 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/RepositoryMetaData.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/RepositoryMetadata.java @@ -30,7 +30,7 @@ import java.util.Objects; /** * Metadata about registered repository */ -public class RepositoryMetaData { +public class RepositoryMetadata { public static final Version REPO_GEN_IN_CS_VERSION = Version.V_7_6_0; @@ -55,15 +55,15 @@ public class RepositoryMetaData { * @param type repository type * @param settings repository settings */ - public RepositoryMetaData(String name, String type, Settings settings) { + public RepositoryMetadata(String name, String type, Settings settings) { this(name, type, settings, RepositoryData.UNKNOWN_REPO_GEN, RepositoryData.EMPTY_REPO_GEN); } - public RepositoryMetaData(RepositoryMetaData metaData, long generation, long pendingGeneration) { - this(metaData.name, metaData.type, metaData.settings, generation, pendingGeneration); + public RepositoryMetadata(RepositoryMetadata metadata, long generation, long pendingGeneration) { + this(metadata.name, metadata.type, metadata.settings, generation, pendingGeneration); } - public RepositoryMetaData(String name, String type, Settings settings, long generation, long pendingGeneration) { + public RepositoryMetadata(String name, String type, Settings settings, long generation, long pendingGeneration) { this.name = name; this.type = type; this.settings = settings; @@ -124,7 +124,7 @@ public class RepositoryMetaData { return pendingGeneration; } - public RepositoryMetaData(StreamInput in) throws IOException { + public RepositoryMetadata(StreamInput in) throws IOException { name = in.readString(); type = in.readString(); settings = Settings.readSettingsFromStream(in); @@ -158,7 +158,7 @@ public class RepositoryMetaData { * @param other other repository metadata * @return {@code true} if both instances equal in all fields but the generation fields */ - public boolean equalsIgnoreGenerations(RepositoryMetaData other) { + public boolean equalsIgnoreGenerations(RepositoryMetadata other) { return name.equals(other.name) && type.equals(other.type()) && settings.equals(other.settings()); } @@ -167,7 +167,7 @@ public class RepositoryMetaData { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - RepositoryMetaData that = (RepositoryMetaData) o; + RepositoryMetadata that = (RepositoryMetadata) o; if (!name.equals(that.name)) return false; if (!type.equals(that.type)) return false; @@ -183,6 +183,6 @@ public class RepositoryMetaData { @Override public String toString() { - return "RepositoryMetaData{" + name + "}{" + type + "}{" + settings + "}{" + generation + "}{" + pendingGeneration + "}"; + return "RepositoryMetadata{" + name + "}{" + type + "}{" + settings + "}{" + generation + "}{" + pendingGeneration + "}"; } } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/Template.java b/server/src/main/java/org/elasticsearch/cluster/metadata/Template.java index b86eaf3598e..eb819bb8f39 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/Template.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/Template.java @@ -53,16 +53,16 @@ public class Template extends AbstractDiffable