Pause Index Operation



Overview

Which node is the index paused for?

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

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


What happens when an index is paused for a node?

  • A paused index performs no indexing for the node it is paused for.
    New data is indexed by the index on database-group nodes that the index is not paused for.

  • A paused index can be queried, but results may be stale when querying the node that the index is paused for.


Resuming the index:

  • Learn how to resume an index by a client here: Resume index

  • Learn to resume an index from Studio here: 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 it).
      Toggling the database state can be done using the Studio database list view,
      or using ToggleDatabasesStateOperation by the client.
  • Resetting a paused index will resume the normal operation of the index
    on the local node where the reset action was performed.

  • Modifying the index definition will resume the normal operation of the index
    on all the nodes for which it is paused.

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