---
title: luna indexes
description: List an environment's indexes, see one in full and read the rows of one partition.
related:
  - /data/query-across-lunas
  - /cli/status
---

`luna indexes` shows an environment's indexes and reads their rows. It only reads: an index is made, changed and removed by deploying code that declares it with `defineIndex`.

```bash
luna indexes
```

## Reference

```bash
luna indexes [OPTIONS] [NAME]
luna indexes find [OPTIONS] --partition <PARTITION> <NAME>
```

Both forms act on one environment, and take these options.

| Option | Type | Default | Does |
| --- | --- | --- | --- |
| `--dir <DIR>` | path | `.` | The app's folder. Its env file names the project and environment. |
| `--env <ENV>` | text | `LUNA_ENV`, then `production` | The environment, by name. |
| `--project <PROJECT>` | text | `LUNA_PROJECT` | The project, by name or as `organisation/project`. |
| `--tenant <TENANT>` | text | The environment's own | A tenant added to the environment, by name. |
| `--token <TOKEN>` | text | `LUNA_TOKEN`, then your login | An API token or account key to act with. |

### luna indexes

Lists the environment's indexes with their numbers, or shows one in full.

```bash
luna indexes [OPTIONS] [NAME]
```

| Option | Type | Default | Does |
| --- | --- | --- | --- |
| `[NAME]` | text | None | Shows this index in full, with its columns. Without it, a line for each index. |
| `--since <SINCE>` | length | `1h` | How far back the numbers go, such as `90s`, `15m`, `2h` or `3d`. |
| `--json` | flag | Off | Prints the answer as JSON. |

One index in full also shows what it cost this month, for a login or token allowed to read usage.

### luna indexes find

Prints the rows of one partition of an index, or the ones that match a search.

```bash
luna indexes find [OPTIONS] --partition <PARTITION> <NAME>
```

| Option | Type | Default | Does |
| --- | --- | --- | --- |
| `<NAME>` | text | Required | The index, by name. |
| `--partition <PARTITION>` | text | Required | Which partition: a value of the index's partition field. |
| `--search <WORDS>` | text | None | Prints only rows with these words in the columns the index searches. |
| `--limit <LIMIT>` | number | `50` | The most rows to print, from 1 to 1000. |
| `--json` | flag | Off | Prints the rows as JSON. |

`--search` works only on an index whose definition names columns to search.

## Good to know

- `luna indexes` is also `luna index`.
- `luna status <NAME>` with an index's name shows the same as `luna indexes <NAME>`.

## Examples

### List the indexes of production

```bash
luna indexes --env production
```

### See one index in full

```bash
luna indexes <INDEX>
```

### Read one partition

```bash
luna indexes find <INDEX> --partition <VALUE> --limit 100
```

### Search one partition

```bash
luna indexes find <INDEX> --partition <VALUE> --search "milk"
```
