org.elasticsearch.action.admin.indices.optimize
Class OptimizeRequest

java.lang.Object
  extended by org.elasticsearch.action.support.broadcast.BroadcastOperationRequest
      extended by org.elasticsearch.action.admin.indices.optimize.OptimizeRequest
All Implemented Interfaces:
ActionRequest, Streamable

public class OptimizeRequest
extends BroadcastOperationRequest

A request to optimize one or more indices. In order to optimize on all the indices, pass an empty array or null for the indices.

waitForMerge(boolean) allows to control if the call will block until the optimize completes and defaults to true.

maxNumSegments(int) allows to control the number of segments to optimize down to. By default, will cause the optimize process to optimize down to half the configured number of segments.

See Also:
Requests.optimizeRequest(String...), IndicesAdminClient.optimize(OptimizeRequest), OptimizeResponse

Nested Class Summary
static class OptimizeRequest.Defaults
           
 
Field Summary
 
Fields inherited from class org.elasticsearch.action.support.broadcast.BroadcastOperationRequest
indices
 
Constructor Summary
OptimizeRequest()
           
OptimizeRequest(String... indices)
          Constructs an optimization request over one or more indices.
 
Method Summary
 boolean flush()
          Should flush be performed after the optimization.
 OptimizeRequest flush(boolean flush)
          Should flush be performed after the optimization.
 OptimizeRequest listenerThreaded(boolean threadedListener)
          Should the listener be called on a separate thread if needed.
 int maxNumSegments()
          Will optimize the index down to <= maxNumSegments.
 OptimizeRequest maxNumSegments(int maxNumSegments)
          Will optimize the index down to <= maxNumSegments.
 boolean onlyExpungeDeletes()
          Should the optimization only expunge deletes from the index, without full optimization.
 OptimizeRequest onlyExpungeDeletes(boolean onlyExpungeDeletes)
          Should the optimization only expunge deletes from the index, without full optimization.
 OptimizeRequest operationThreading(BroadcastOperationThreading operationThreading)
          Controls the operation threading model.
 void readFrom(StreamInput in)
           
 boolean refresh()
          Should refresh be performed after the optimization.
 OptimizeRequest refresh(boolean refresh)
          Should refresh be performed after the optimization.
 boolean waitForMerge()
          Should the call block until the optimize completes.
 OptimizeRequest waitForMerge(boolean waitForMerge)
          Should the call block until the optimize completes.
 void writeTo(StreamOutput out)
           
 
Methods inherited from class org.elasticsearch.action.support.broadcast.BroadcastOperationRequest
beforeLocalFork, beforeStart, ignoreIndices, ignoreIndices, indices, indices, listenerThreaded, operationThreading, operationThreading, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptimizeRequest

public OptimizeRequest(String... indices)
Constructs an optimization request over one or more indices.

Parameters:
indices - The indices to optimize, no indices passed means all indices will be optimized.

OptimizeRequest

public OptimizeRequest()
Method Detail

listenerThreaded

public OptimizeRequest listenerThreaded(boolean threadedListener)
Description copied from class: BroadcastOperationRequest
Should the listener be called on a separate thread if needed.

Specified by:
listenerThreaded in interface ActionRequest
Overrides:
listenerThreaded in class BroadcastOperationRequest

operationThreading

public OptimizeRequest operationThreading(BroadcastOperationThreading operationThreading)
Description copied from class: BroadcastOperationRequest
Controls the operation threading model.

Overrides:
operationThreading in class BroadcastOperationRequest

waitForMerge

public boolean waitForMerge()
Should the call block until the optimize completes. Defaults to true.


waitForMerge

public OptimizeRequest waitForMerge(boolean waitForMerge)
Should the call block until the optimize completes. Defaults to true.


maxNumSegments

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


maxNumSegments

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


onlyExpungeDeletes

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


onlyExpungeDeletes

public OptimizeRequest onlyExpungeDeletes(boolean onlyExpungeDeletes)
Should the optimization only expunge deletes from the index, without full optimization. Defaults to full optimization (false).


flush

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


flush

public OptimizeRequest flush(boolean flush)
Should flush be performed after the optimization. Defaults to true.


refresh

public boolean refresh()
Should refresh be performed after the optimization. Defaults to true.


refresh

public OptimizeRequest refresh(boolean refresh)
Should refresh be performed after the optimization. Defaults to true.


readFrom

public void readFrom(StreamInput in)
              throws IOException
Specified by:
readFrom in interface Streamable
Overrides:
readFrom in class BroadcastOperationRequest
Throws:
IOException

writeTo

public void writeTo(StreamOutput out)
             throws IOException
Specified by:
writeTo in interface Streamable
Overrides:
writeTo in class BroadcastOperationRequest
Throws:
IOException


Copyright © 2009-2012. All Rights Reserved.