Class ForceMergeRequest

All Implemented Interfaces:
IndicesRequest, IndicesRequest.Replaceable, Writeable, org.elasticsearch.core.RefCounted, TaskAwareRequest

public class ForceMergeRequest extends BroadcastRequest<ForceMergeRequest>
A request to force merging the segments of one or more indices. In order to run a merge on all the indices, pass an empty array or null for the indices. maxNumSegments(int) allows to control the number of segments to force merge down to. Defaults to simply checking if a merge needs to execute, and if so, executes it
See Also:
Requests.forceMergeRequest(String...), IndicesAdminClient.forceMerge(ForceMergeRequest), ForceMergeResponse
  • Constructor Details

    • ForceMergeRequest

      public ForceMergeRequest(String... indices)
      Constructs a merge request over one or more indices.
      Parameters:
      indices - The indices to merge, no indices passed means all indices will be merged.
    • ForceMergeRequest

      public ForceMergeRequest(StreamInput in) throws IOException
      Throws:
      IOException
  • Method Details

    • maxNumSegments

      public int maxNumSegments()
      Will merge the index down to <= maxNumSegments. By default, will cause the merge process to merge down to half the configured number of segments.
    • maxNumSegments

      public ForceMergeRequest maxNumSegments(int maxNumSegments)
      Will merge the index down to <= maxNumSegments. By default, will cause the merge process to merge down to half the configured number of segments.
    • onlyExpungeDeletes

      public boolean onlyExpungeDeletes()
      Should the merge only expunge deletes from the index, without full merging. Defaults to full merging (false).
    • onlyExpungeDeletes

      public ForceMergeRequest onlyExpungeDeletes(boolean onlyExpungeDeletes)
      Should the merge only expunge deletes from the index, without full merge. Defaults to full merging (false).
    • forceMergeUUID

      @Nullable public String forceMergeUUID()
      Force merge UUID to use when force merging or null if not using one in a mixed version cluster containing nodes older than FORCE_MERGE_UUID_VERSION.
    • flush

      public boolean flush()
      Should flush be performed after the merge. Defaults to true.
    • flush

      public ForceMergeRequest flush(boolean flush)
      Should flush be performed after the merge. Defaults to true.
    • getDescription

      public String getDescription()
      Description copied from interface: TaskAwareRequest
      Returns optional description of the request to be displayed by the task manager
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Overrides:
      writeTo in class BroadcastRequest<ForceMergeRequest>
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class TransportRequest