Class MoveAllocationCommand
- java.lang.Object
-
- org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand
-
- All Implemented Interfaces:
AllocationCommand,NamedWriteable,Writeable,ToXContent,ToXContentObject
public class MoveAllocationCommand extends Object implements AllocationCommand
A command that moves a shard from a specific node to another node.
Note: The shard needs to be in the stateShardRoutingState.STARTEDin order to be moved.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
-
Field Summary
Fields Modifier and Type Field Description static ParseFieldCOMMAND_NAME_FIELDstatic StringNAME-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description MoveAllocationCommand(String index, int shardId, String fromNode, String toNode)MoveAllocationCommand(StreamInput in)Read from a stream.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)RerouteExplanationexecute(RoutingAllocation allocation, boolean explain)Executes the command on aRoutingAllocationsetupStringfromNode()static MoveAllocationCommandfromXContent(XContentParser parser)inthashCode()Stringindex()Stringname()Get the name of the commandintshardId()StringtoNode()XContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)voidwriteTo(StreamOutput out)Write this into the StreamOutput.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.cluster.routing.allocation.command.AllocationCommand
getMessage, getWriteableName
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
COMMAND_NAME_FIELD
public static final ParseField COMMAND_NAME_FIELD
-
-
Constructor Detail
-
MoveAllocationCommand
public MoveAllocationCommand(String index, int shardId, String fromNode, String toNode)
-
MoveAllocationCommand
public MoveAllocationCommand(StreamInput in) throws IOException
Read from a stream.- Throws:
IOException
-
-
Method Detail
-
writeTo
public void writeTo(StreamOutput out) throws IOException
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
name
public String name()
Description copied from interface:AllocationCommandGet the name of the command- Specified by:
namein interfaceAllocationCommand- Returns:
- name of the command
-
index
public String index()
-
shardId
public int shardId()
-
fromNode
public String fromNode()
-
toNode
public String toNode()
-
execute
public RerouteExplanation execute(RoutingAllocation allocation, boolean explain)
Description copied from interface:AllocationCommandExecutes the command on aRoutingAllocationsetup- Specified by:
executein interfaceAllocationCommand- Parameters:
allocation-RoutingAllocationto modify
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
- Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
fromXContent
public static MoveAllocationCommand fromXContent(XContentParser parser) throws IOException
- Throws:
IOException
-
-