You are currently browsing legacy 4.0 version of documentation. Click here to switch to the newest 4.2 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Operations: How to Change the Index Lock Mode

SetIndexesLockOperation allows you to change index lock mode for a given index or indexes.

Syntax

public SetIndexesLockOperation(string indexName, IndexLockMode lockMode);
public SetIndexesLockOperation(Parameters parameters);

public enum IndexLockMode
{
    Unlock = 0,
    LockedIgnore = 1,
    LockedError = 2
}

public class Parameters
{
    public string[] IndexNames { get; set; }
    public IndexLockMode Mode { get; set; }
}

Parameters
name string name of an index to change lock mode for
lockMode IndexLockMode new index lock mode
parameters SetIndexesLockOperation.Parameters list of indexes + new index lock mode

Example I

store.Maintenance.Send(new SetIndexesLockOperation(new SetIndexesLockOperation.Parameters
{
    IndexNames = new []{ "Orders/Totals", "Orders/ByCompany" },
    Mode = IndexLockMode.LockedIgnore
}));

Example II

store.Maintenance.Send(new SetIndexesLockOperation(new SetIndexesLockOperation.Parameters
{
    IndexNames = new []{ "Orders/Totals", "Orders/ByCompany" },
    Mode = IndexLockMode.LockedIgnore
}));