You are currently browsing legacy 4.1 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 Index Priority

SetIndexesPriorityOperation allows you to change an index priority for a given index or indexes.

Syntax

public SetIndexesPriorityOperation(String indexName, IndexPriority priority) {
public SetIndexesPriorityOperation(SetIndexesPriorityOperation.Parameters parameters)

public enum IndexPriority {
    LOW,
    NORMAL,
    HIGH
}

public static class Parameters {
    private String[] indexNames;
    private IndexPriority priority;

    public String[] getIndexNames() {
        return indexNames;
    }

    public void setIndexNames(String[] indexNames) {
        this.indexNames = indexNames;
    }

    public IndexPriority getPriority() {
        return priority;
    }

    public void setPriority(IndexPriority priority) {
        this.priority = priority;
    }
}

Parameters
name String name of an index to change priority for
priority IndexingPriority new index priority
parameters SetIndexesPriorityOperation.Parameters list of indexes + new index priority

Example I

store.maintenance().send(
    new SetIndexesPriorityOperation("Orders/Totals", IndexPriority.HIGH));

Example II

SetIndexesPriorityOperation.Parameters parameters = new SetIndexesPriorityOperation.Parameters();
parameters.setIndexNames(new String[]{ "Orders/Totals", "Orders/ByCompany" });
parameters.setPriority(IndexPriority.LOW);

store.maintenance().send(new SetIndexesPriorityOperation(parameters));