---
title: "Get Index Operation"
url: "https://docs.ravendb.net/6.2/client-api/operations/maintenance/indexes/get-index"
version: "6.2"
language: "php"
---

# Get Index Operation

> Client language: PHP. Also available for [C#](https://docs.ravendb.net/6.2/client-api/operations/maintenance/indexes/get-index.md), [Java](https://docs.ravendb.net/6.2/client-api/operations/maintenance/indexes/get-index.java.md), [Python](https://docs.ravendb.net/6.2/client-api/operations/maintenance/indexes/get-index.python.md), [Node.js](https://docs.ravendb.net/6.2/client-api/operations/maintenance/indexes/get-index.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."

> **Note**
>
> - Use `GetIndexOperation` to retrieve an index definition from the database.
>
> - The operation will execute on the node defined by the [client configuration](https://docs.ravendb.net/6.2/client-api/configuration/load-balance/overview.md#client-logic-for-choosing-a-node).  
>   However, the index definition returned is taken from the database record,  
>   which is common to all the database-group nodes.  
>   i.e., an index state change done only on a local node is not reflected.
>
> - To get the index state on the local node use `GetIndexStatisticsOperation`.
>
> - In this page:
>   - [Get Index example](#get-index-example)
>   - [Syntax](#syntax)

## Get Index example

```php
// Define the get index operation, pass the index name
$getIndexOp = new GetIndexOperation("Orders/Totals");

// Execute the operation by passing it to Maintenance.Send
/** @var IndexDefinition $index */
$index = $store->maintenance()->send($getIndexOp);

// Access the index definition
$state = $index->getState();
$lockMode = $index->getLockMode();
$deploymentMode = $index->getDeploymentMode();
// etc.
```

### Syntax

```php
GetIndexOperation(?string $indexName)
```

| Parameters | Type | Description |
| - | - | - |
| **$indexName** | `?string` | Name of index to get |

## See also

- [What are Indexes](https://docs.ravendb.net/6.2/indexes/what-are-indexes.php.md)
- [Creating and Deploying Indexes](https://docs.ravendb.net/6.2/indexes/creating-and-deploying.md)
- [Index Administration](https://docs.ravendb.net/6.2/indexes/index-administration.md)
- [How to Get Indexes](https://docs.ravendb.net/6.2/client-api/operations/maintenance/indexes/get-indexes.php.md)
- [How to Put Indexes](https://docs.ravendb.net/6.2/client-api/operations/maintenance/indexes/put-indexes.php.md)
- [How to Delete Index](https://docs.ravendb.net/6.2/client-api/operations/maintenance/indexes/delete-index.php.md)
