Pause Index Operation



Overview

On which node the index is paused:

  • When pausing the index from the client:
    The index will be paused on the preferred node only, and Not on all the database-group nodes.

  • When pausing the index from the Studio (from the indexes list view):
    The index will be paused on the local node the browser is opened on, even if it is Not the preferred node.

When index is paused on a node:

  • No indexing will be done by the paused index on the node where index was paused.
    However, new data will be indexed by the index on other database-group nodes where it was not paused.

  • You can query the index,
    but results may be stale when querying the node where the index is paused.

  • You can modify the index definition of a paused index.
    Once index is resumed, re-indexing will be triggered on the node.

How to resume the index:

  • To resume the index from the client - see resume index.

  • To resume the index from the Studio - go to the indexes list view.

  • Pausing the index is Not a persistent operation.
    This means the paused index will resume upon either of the following:

    • The server is restarted.
    • The database is re-loaded (by disabling and then enabling the database state).
      Toggling the database state can be done from database list view in Studio,
      or from the client by sending the ToggleDatabasesStateOperation.

Pause index example

// Define the pause index operation, pass the index name 
var pauseIndexOp = new StopIndexOperation("Orders/Totals");

// Execute the operation by passing it to Maintenance.Send
store.Maintenance.Send(pauseIndexOp);

// At this point:
// Index 'Orders/Totals' is paused on the preferred node
        
// Can verify the index status on the preferred node by sending GetIndexingStatusOperation
var indexingStatus = store.Maintenance.Send(new GetIndexingStatusOperation());

var index = indexingStatus.Indexes.FirstOrDefault(x => x.Name == "Orders/Totals");
Assert.Equal(IndexRunningStatus.Paused, index.Status);
// Define the pause index operation, pass the index name 
var pauseIndexOp = new StopIndexOperation("Orders/Totals");

// Execute the operation by passing it to Maintenance.SendAsync
await store.Maintenance.SendAsync(pauseIndexOp);

// At this point:
// Index 'Orders/Totals' is paused on the preferred node
        
// Can verify the index status on the preferred node by sending GetIndexingStatusOperation
var indexingStatus = await store.Maintenance.SendAsync(new GetIndexingStatusOperation());

var index = indexingStatus.Indexes.FirstOrDefault(x => x.Name == "Orders/Totals");
Assert.Equal(IndexRunningStatus.Paused, index.Status);

Syntax

// class name has "Stop", but this is ok, this is the "Pause" operation
public StopIndexOperation(string indexName)
Parameters Type Description
indexName string Name of an index to pause