Get Index Errors Operation



Get errors for all indexes

# Define the get index errors operation
get_index_errors_op = GetIndexErrorsOperation()

# Execute the operation by passing it to maintenance.send
index_errors = store.maintenance.send(get_index_errors_op)

# index_errors will contain errors for ALL indexes

Get errors for specific indexes

# Define the get index errors operation for specific indexes
get_index_errors_op = GetIndexErrorsOperation("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
index_errors = store.maintenance.send(get_index_errors_op)

# index_errors will contain errors only for index "Orders/Totals"

Syntax

class GetIndexErrorsOperation(MaintenanceOperation[List[IndexErrors]]):
    def __init__(self, *index_names: str):  # If no index_names provided, get errors for all indexes
        ...
Parameters Type Description
*index_names str List of index names to get errors for
Return value of
store.maintenance.send(GetIndexErrorsOperation)
Description
List[IndexErrors] List of IndexErrors classes - see definition below.
An exception is thrown if any of the specified indexes doesn't exist.

class IndexErrors:
    def __init__(self, name: Optional[str] = None, errors: Optional[List[IndexingError]] = None):
        self.name = name  # Index name
        self.errors = errors  # List of errors for this index

class IndexingError:
    def __init__(
        self,
        error: Optional[str] = None,
        timestamp: Optional[datetime.datetime] = None,
        document: Optional[str] = None,
        action: Optional[str] = None,
    ):
        # Error message
        self.error = error

        # Time of error
        self.timestamp = timestamp

        # 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 None
        self.document = document

        # Area where error has occurred, e.g. Map/Reduce/Analyzer/Memory/etc.
        self.action = action