# Create Custom Index

> Create an index for custom entities data.

Create an index for custom entities data.

Authentication Required: `Yes`

```bash
ugs cloud-save data index custom create [options]
```

## Arguments

`<fields>` An array of fields in an index represented in json. Each field must be unique within the array. Each field accepts a `key` string and an `asc` field, set to true or false.

Index creation commands can use either a `fields` argument or a `body` argument. If both are set, `fields` will be used.

Sample Fields Argument

```text
--fields "[{\"key\":\"myIndexedKey\",\"asc\":true},{\"key\":\"myIndexedKey2\",\"asc\":false}]"
```

`<visibility>` A string representing the visibility of the index. Must be one of `default` or `private`.
`<body>` The index definition in JSON. If this is a file path, the content of the file is used; otherwise, the raw string is used. If `fields` is set, it is used instead.

Sample Index Creation Body

```json
{
  "indexConfig": {
    "fields": [
      {
        "key": "myIndexedKey",
        "asc": true
      },
      {
        "key": "myIndexedKey2",
        "asc": false
      }
    ]
  }
}
```

## Documentation

For more documentation on index creation, see the [Unity Service API Docs](https://services.docs.unity.com/cloud-save-admin/v1/index.html#tag/Data/operation/createDefaultCustomIndex).

## Options

| Option           | Alias                  | Description                         |
| ---------------- | ---------------------- | ----------------------------------- |
| project-id       | -p, --project-id       | The Unity cloud project ID.         |
| environment-name | -e, --environment-name | The services environment name.      |
| help             | -?, -h, --help         | Display help and usage information. |
| quiet            | -q, --quiet            | Reduce logging to a minimum.        |
| json             | -j, --json             | Use JSON as the output format.      |
