Get Index Errors Operation



Get errors for all indexes

// Define the get index errors operation
var getIndexErrorsOp = new GetIndexErrorsOperation();

// Execute the operation by passing it to Maintenance.Send
IndexErrors[] indexErrors = store.Maintenance.Send(getIndexErrorsOp);

// indexErrors will contain errors for ALL indexes
// Define the get index errors operation
var getIndexErrorsOp = new GetIndexErrorsOperation();

// Execute the operation by passing it to Maintenance.SendAsync
IndexErrors[] indexErrors = await store.Maintenance.SendAsync(getIndexErrorsOp);

// indexErrors will contain errors for ALL indexes

Get errors for specific indexes

// Define the get index errors operation for specific indexes
var getIndexErrorsOp = new GetIndexErrorsOperation(new[] { "Orders/Totals" });

// Execute the operation by passing it to Maintenance.Send
// An exception will be thrown if any of the specified indexes do not exist
IndexErrors[] indexErrors = store.Maintenance.Send(getIndexErrorsOp);

// indexErrors will contain errors only for index "Orders/Totals"
// Define the get index errors operation for specific indexes
var getIndexErrorsOp = new GetIndexErrorsOperation(new[] { "Orders/Totals" });

// Execute the operation by passing it to Maintenance.SendAsync
// An exception will be thrown if any of the specified indexes do not exist
IndexErrors[] indexErrors = await store.Maintenance.SendAsync(getIndexErrorsOp);

// indexErrors will contain errors only for index "Orders/Totals"

Syntax

// Available overloads:
public GetIndexErrorsOperation()                    // Get errors for all indexes
public GetIndexErrorsOperation(string[] indexNames) // Get errors for specific indexes
Parameters Type Description
indexNames string[] List of index names for which to get errors
Return value of store.Maintenance.Send(getIndexErrorsOp)
IndexErrors[] List of IndexErrors class.
An exception is thrown if any of the specified indexes do not exist.

public class IndexErrors
{
    public string Name { get; set; }            // Index name
    public IndexingError[] Errors { get; set; } // List of errors for this index
}

public class IndexingError
{
    // The error message
    public string Error { get; set; }
    
    // Time of error
    public DateTime Timestamp { get; set; }
    
    // If Action is 'Map'    - field will contain the document ID
    // If Action is 'Reduce' - field will contain the Reduce key value
    // For all other Actions - field will be null 
    public string Document { get; set; }
    
    // Area where error has occurred, e.g. Map/Reduce/Analyzer/Memory/etc.
    public string Action { get; set; }      
}