Class IndexMetaData.Builder
- java.lang.Object
-
- org.elasticsearch.cluster.metadata.IndexMetaData.Builder
-
- Enclosing class:
- IndexMetaData
public static class IndexMetaData.Builder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Builder(java.lang.String index)Builder(IndexMetaData indexMetaData)
-
Method Summary
Modifier and Type Method Description longaliasesVersion()IndexMetaData.BuilderaliasesVersion(long aliasesVersion)IndexMetaDatabuild()IndexMetaData.BuildercreationDate(long creationDate)static IndexMetaDatafromXContent(XContentParser parser)java.util.Set<java.lang.String>getInSyncAllocationIds(int shardId)intgetRoutingNumShards()Returns number of shards that should be used for routing.IndexMetaData.Builderindex(java.lang.String index)MappingMetaDatamapping(java.lang.String type)longmappingVersion()IndexMetaData.BuildermappingVersion(long mappingVersion)IndexMetaData.BuildernumberOfReplicas(int numberOfReplicas)intnumberOfShards()Returns the number of shards.IndexMetaData.BuildernumberOfShards(int numberOfShards)longprimaryTerm(int shardId)returns the primary term for the given shard.IndexMetaData.BuilderprimaryTerm(int shardId, long primaryTerm)sets the primary term for the given shard.IndexMetaData.BuilderputAlias(AliasMetaData aliasMetaData)IndexMetaData.BuilderputAlias(AliasMetaData.Builder aliasMetaData)IndexMetaData.BuilderputCustom(java.lang.String type, java.util.Map<java.lang.String,java.lang.String> customIndexMetaData)IndexMetaData.BuilderputInSyncAllocationIds(int shardId, java.util.Set<java.lang.String> allocationIds)IndexMetaData.BuilderputMapping(java.lang.String type, java.lang.String source)IndexMetaData.BuilderputMapping(MappingMetaData mappingMd)IndexMetaData.BuilderputRolloverInfo(RolloverInfo rolloverInfo)IndexMetaData.BuilderremoveAlias(java.lang.String alias)IndexMetaData.BuilderremoveAllAliases()java.util.Map<java.lang.String,java.lang.String>removeCustom(java.lang.String type)IndexMetaData.BuilderroutingPartitionSize(int routingPartitionSize)IndexMetaData.BuildersetRoutingNumShards(int routingNumShards)Sets the number of shards that should be used for routing.IndexMetaData.Buildersettings(Settings settings)IndexMetaData.Buildersettings(Settings.Builder settings)longsettingsVersion()IndexMetaData.BuildersettingsVersion(long settingsVersion)IndexMetaData.Builderstate(IndexMetaData.State state)static voidtoXContent(IndexMetaData indexMetaData, XContentBuilder builder, ToXContent.Params params)longversion()IndexMetaData.Builderversion(long version)
-
-
-
Constructor Detail
-
Builder
public Builder(java.lang.String index)
-
Builder
public Builder(IndexMetaData indexMetaData)
-
-
Method Detail
-
index
public IndexMetaData.Builder index(java.lang.String index)
-
numberOfShards
public IndexMetaData.Builder numberOfShards(int numberOfShards)
-
setRoutingNumShards
public IndexMetaData.Builder setRoutingNumShards(int routingNumShards)
Sets the number of shards that should be used for routing. This should only be used if the number of shards in an index has changed ie if the index is shrunk.
-
getRoutingNumShards
public int getRoutingNumShards()
Returns number of shards that should be used for routing. By default this method will return the number of shards for this index.- See Also:
setRoutingNumShards(int),numberOfShards()
-
numberOfShards
public int numberOfShards()
Returns the number of shards.- Returns:
- the provided value or -1 if it has not been set.
-
numberOfReplicas
public IndexMetaData.Builder numberOfReplicas(int numberOfReplicas)
-
routingPartitionSize
public IndexMetaData.Builder routingPartitionSize(int routingPartitionSize)
-
creationDate
public IndexMetaData.Builder creationDate(long creationDate)
-
settings
public IndexMetaData.Builder settings(Settings.Builder settings)
-
settings
public IndexMetaData.Builder settings(Settings settings)
-
mapping
public MappingMetaData mapping(java.lang.String type)
-
putMapping
public IndexMetaData.Builder putMapping(java.lang.String type, java.lang.String source) throws java.io.IOException
- Throws:
java.io.IOException
-
putMapping
public IndexMetaData.Builder putMapping(MappingMetaData mappingMd)
-
state
public IndexMetaData.Builder state(IndexMetaData.State state)
-
putAlias
public IndexMetaData.Builder putAlias(AliasMetaData aliasMetaData)
-
putAlias
public IndexMetaData.Builder putAlias(AliasMetaData.Builder aliasMetaData)
-
removeAlias
public IndexMetaData.Builder removeAlias(java.lang.String alias)
-
removeAllAliases
public IndexMetaData.Builder removeAllAliases()
-
putCustom
public IndexMetaData.Builder putCustom(java.lang.String type, java.util.Map<java.lang.String,java.lang.String> customIndexMetaData)
-
removeCustom
public java.util.Map<java.lang.String,java.lang.String> removeCustom(java.lang.String type)
-
getInSyncAllocationIds
public java.util.Set<java.lang.String> getInSyncAllocationIds(int shardId)
-
putInSyncAllocationIds
public IndexMetaData.Builder putInSyncAllocationIds(int shardId, java.util.Set<java.lang.String> allocationIds)
-
putRolloverInfo
public IndexMetaData.Builder putRolloverInfo(RolloverInfo rolloverInfo)
-
version
public long version()
-
version
public IndexMetaData.Builder version(long version)
-
mappingVersion
public long mappingVersion()
-
mappingVersion
public IndexMetaData.Builder mappingVersion(long mappingVersion)
-
settingsVersion
public long settingsVersion()
-
settingsVersion
public IndexMetaData.Builder settingsVersion(long settingsVersion)
-
aliasesVersion
public long aliasesVersion()
-
aliasesVersion
public IndexMetaData.Builder aliasesVersion(long aliasesVersion)
-
primaryTerm
public long primaryTerm(int shardId)
returns the primary term for the given shard. SeeIndexMetaData.primaryTerm(int)for more information.
-
primaryTerm
public IndexMetaData.Builder primaryTerm(int shardId, long primaryTerm)
sets the primary term for the given shard. SeeIndexMetaData.primaryTerm(int)for more information.
-
build
public IndexMetaData build()
-
toXContent
public static void toXContent(IndexMetaData indexMetaData, XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Throws:
java.io.IOException
-
fromXContent
public static IndexMetaData fromXContent(XContentParser parser) throws java.io.IOException
- Throws:
java.io.IOException
-
-