---
title: "Set Index Lock Mode Operation"
url: "https://docs.ravendb.net/6.2/client-api/operations/maintenance/indexes/set-index-lock"
version: "6.2"
language: "java"
---

# Set Index Lock Mode Operation

> Client language: Java. Also available for [C#](https://docs.ravendb.net/6.2/client-api/operations/maintenance/indexes/set-index-lock.md), [Python](https://docs.ravendb.net/6.2/client-api/operations/maintenance/indexes/set-index-lock.python.md), [PHP](https://docs.ravendb.net/6.2/client-api/operations/maintenance/indexes/set-index-lock.php.md), [Node.js](https://docs.ravendb.net/6.2/client-api/operations/maintenance/indexes/set-index-lock.nodejs.md).
>
> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

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

## Syntax

```java
public SetIndexesLockOperation(String indexName, IndexLockMode mode)
public SetIndexesLockOperation(SetIndexesLockOperation.Parameters parameters)
```

```java
public enum IndexLockMode {
  UNLOCK,
  LOCKED_IGNORE,
  LOCKED_ERROR
}
```

```java
public static class Parameters {
  private String[] indexNames;
  private IndexLockMode mode;

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

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

  public IndexLockMode getMode() {
      return mode;
  }

  public void setMode(IndexLockMode mode) {
      this.mode = mode;
  }
}
```

| 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

```java
store.maintenance().send(new SetIndexesLockOperation("Orders/Totals", IndexLockMode.LOCKED_IGNORE));
```

## Example II

```java
SetIndexesLockOperation.Parameters parameters = new SetIndexesLockOperation.Parameters();
parameters.setIndexNames(new String[]{ "Orders/Totals", "Orders/ByCompany" });
parameters.setMode(IndexLockMode.LOCKED_IGNORE);

store.maintenance().send(new SetIndexesLockOperation(parameters));
```

## See also

- [What are Indexes](https://docs.ravendb.net/6.2/indexes/what-are-indexes.java.md)
- [Creating and Deploying Indexes](https://docs.ravendb.net/6.2/indexes/creating-and-deploying.java.md)
- [Index Administration](https://docs.ravendb.net/6.2/indexes/index-administration.md)
- [How to Change Index Priority](https://docs.ravendb.net/6.2/client-api/operations/maintenance/indexes/set-index-priority.java.md)
