Class IndexMetaData.Builder
- java.lang.Object
-
- org.elasticsearch.cluster.metadata.IndexMetaData.Builder
-
- Enclosing class:
- IndexMetaData
public static class IndexMetaData.Builder extends Object
-
-
Constructor Summary
Constructors Constructor Description Builder(String index)Builder(IndexMetaData indexMetaData)
-
Method Summary
-
-
-
Constructor Detail
-
Builder
public Builder(String index)
-
Builder
public Builder(IndexMetaData indexMetaData)
-
-
Method Detail
-
index
public IndexMetaData.Builder index(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(String type)
-
putMapping
public IndexMetaData.Builder putMapping(String type, String source) throws IOException
- Throws:
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(String alias)
-
removeAllAliases
public IndexMetaData.Builder removeAllAliases()
-
putCustom
public IndexMetaData.Builder putCustom(String type, Map<String,String> customIndexMetaData)
-
putInSyncAllocationIds
public IndexMetaData.Builder putInSyncAllocationIds(int shardId, Set<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 IOException
- Throws:
IOException
-
fromXContent
public static IndexMetaData fromXContent(XContentParser parser) throws IOException
- Throws:
IOException
-
-