---
title: "The CLI index command"
slug: "the-cli-index-command"
abstract: "Reference of the DevEx CLI index command that automates indexing operations."
---
# The CLI index command

The [Sitecore indexing plugin](https://doc.sitecore.com/xp/en/developers/101/developer-tools/indexing-plugin.html "Indexing plugin") includes an `index` command. This command automates indexing operations. To install the indexing plugin, run the following code:

```text
dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.Indexing --version 4.0.0

```

> [!note]
> This command is available from CLI 4.0 or later.

<details>
<summary><h2>Usage</h2></summary>

You can use the command as follows:

```text
dotnet sitecore index [subcommand] [options]

```

</details>

<details>
<summary><h2>Subcommands</h2></summary>

You can use the following subcommands:

| Subcommand | Description |
| --- | --- |
| `list` | Provides the list of available indexes from the environment |
| `schema-populate` | Populates the managed schema |
| `rebuild` | Rebuilds all the indexes |
| `statistic` | Statistics of all the indexes |

All the subcommands require elevated permissions.

</details>

<details>
<summary><h2>Options</h2></summary>

You can use the following options with the `list` subcommand:

| Option | Required? | Description |
| --- | --- | --- |
| `-n, --environment-name <environment-name>` | Optional | The Sitecore environment to use. Default: `default`. |
| `-c, --config <CONFIG>` | Optional | Path to root `sitecore.config` directory (default: cwd). |
| `-v, --verbose` | Optional | Report additional diagnostic and performance data. |
| `-t, --trace` | Optional | Report additional diagnostic and performance data. |
| `-?, -h, --help` | Optional | Help for the command. |

You can use the following options with the `schema-populate` subcommand:

| Option | Required? | Description |
| --- | --- | --- |
| `-i, --indexes <list-of-indexes>` | Optional | Populate the schema for specified indexes. |
| `-n, --environment-name <environment-name>` | Optional | The Sitecore environment to use. Default: `default`. |
| `-c, --config <CONFIG>` | Optional | Path to root *sitecore.config* directory (default: cwd). |
| `-v, --verbose` | Optional | Report additional diagnostic and performance data. |
| `-t, --trace` | Optional | Report additional diagnostic and performance data. |
| `-?, -h, --help` | Optional | Help for the command. |

You can use the following options with the `rebuild` subcommand:

| Option | Required? | Description |
| --- | --- | --- |
| `-i, --indexes <list-of-indexes>` | Optional | Rebuild the specified indexes. |
| `-n, --environment-name <environment-name>` | Optional | The Sitecore environment to use. Default: `default`. |
| `-c, --config <CONFIG>` | Optional | Path to root *sitecore.config* directory (default: cwd). |
| `-v, --verbose` | Optional | Report additional diagnostic and performance data. |
| `-t, --trace` | Optional | Report additional diagnostic and performance data. |
| `-?, -h, --help` | Optional | Help for the command. |

You can use the following options with the `statistic` subcommand:

| Option | Required? | Description |
| --- | --- | --- |
| `-n, --environment-name <environment-name>` | Optional | The Sitecore environment to use. Default: `default`. |
| `-c, --config <CONFIG>` | Optional | Path to root *sitecore.config* directory (default: cwd). |
| `-t, --trace` | Optional | Report additional diagnostic and performance data. |
| `-?, -h, --help` | Optional | Help for the command. |

</details>

<details>
<summary><h2>Examples</h2></summary>

The following are examples of the `index` command use:

- Command: Result
- `dotnet sitecore index list`:

```

List of Indexes:
sitecore_master_index
sitecore_core_index

```

- `dotnet sitecore index schema-populate`:

```

The search indexes have been populated.

Result:
sitecore_core_index   [job ended]
sitecore_master_index [job ended]
sitecore_web_index    [job ended]

```

- `dotnet sitecore index schema-populate -i sitecore_master_index`:

```

The search indexes have been populated.

Result:
sitecore_master_index [job ended]

```

- `dotnet sitecore index rebuild`:

```

The search indexes have been rebuilt.

Result:
sitecore_core_index   [job ended] [units processsed: 13596]
sitecore_master_index [job ended] [units processsed: 16620]
sitecore_web_index    [job ended] [units processsed: 13596]

```

- `dotnet sitecore index rebuild -i sitecore_master_index`:

```

The search indexes have been rebuilt.

Result:
sitecore_master_index [job ended] [units processsed: 16620]

```

- `dotnet sitecore index statistic`:

```

Index statistics:
 sitecore_core_index
  Rebuild Time: Never Run
  Last Updated: 08/13/2021 - `08:45` (UTC)
  Approximate Throughput: items per second
  Has Deletions: False
  Out of Date: False
  Document Count: 0
  Number of Fields: -1
  Number of Terms: -1

```

</details>