---
title: Indexing grant attributes in PingDirectory
description: If you use PingDirectory, or another directory, to store OAuth persistent grants for PingFederate, you must index the grant attributes.
component: pingfederate
version: 13.1
page_id: pingfederate:administrators_reference_guide:pf_index_grant_attributes_pd
canonical_url: https://docs.pingidentity.com/pingfederate/13.1/administrators_reference_guide/pf_index_grant_attributes_pd.html
llms_txt: https://docs.pingidentity.com/pingfederate/llms.txt
docs_for_agents: https://developer.pingidentity.com/build-with-ai/docs-for-agents.md
revdate: December 8, 2023
section_ids:
  about-this-task: About this task
  steps: Steps
  related-links: Related links
---

# Indexing grant attributes in PingDirectory

If you use PingDirectory, or another directory, to store OAuth persistent grants for PingFederate, you must index the grant attributes.

## About this task

Index these OAuth grant attributes using the procedure below.

| Attribute name                       | Index type |
| ------------------------------------ | ---------- |
| `accessGrantGuid`                    | equality   |
| `accessGrantUniqueUserIdentifier`    | equality   |
| `accessGrantHashedRefreshTokenValue` | equality   |
| `accessGrantClientId`                | equality   |
| `accessGrantExpires`                 | ordering   |
| `accessGrantGrantType`               | equality   |

## Steps

1. Create the indexes using the PingDirectory `dsconfig` utility.

   The `dsconfig` utility is interactive, letting you enter command arguments. The following examples create the required indexes.

   ```shell
   $ bin/dsconfig create-local-db-index \
                     --backend-name userRoot \
                     --index-name accessGrantGuid \
                     --set index-type:equality
   ```

   ```shell
   $ bin/dsconfig create-local-db-index \
                     --backend-name userRoot \
                     --index-name accessGrantUniqueUserIdentifier \
                     --set index-type:equality
   ```

   ```shell
   $ bin/dsconfig create-local-db-index \
                     --backend-name userRoot \
                     --index-name accessGrantHashedRefreshTokenValue \
                     --set index-type:equality
   ```

   ```shell
   $ bin/dsconfig create-local-db-index \
                     --backend-name userRoot \
                     --index-name accessGrantClientId \
                     --set index-type:equality
   ```

   ```shell
   $ bin/dsconfig create-local-db-index \
                     --backend-name userRoot \
                     --index-name accessGrantExpires \
                     --set index-type:ordering
   ```

   ```shell
   $ bin/dsconfig create-local-db-index \
                     --backend-name userRoot \
                     --index-name accessGrantGrantType \
                     --set index-type:equality
   ```

2. After adding the indexes, build the indexes using the `rebuild-index` utility.

   The following example builds the required indexes.

   ```shell
   $ bin/rebuild-index \
                     --baseDN "dc=example,dc=com" \
                     --index accessGrantGuid \
                     --index accessGrantUniqueUserIdentifier \
                     --index accessGrantHashedRefreshTokenValue \
                     --index accessGrantClientId \
                     --index accessGrantExpires \
                     --index accessGrantGrantType
   ```

   |   |                                                                                                                                                                                                                                                                                                                                                                                         |
   | - | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   |   | You can configure a PingDirectory plugin to handle the cleanup of expired persistent grants and the associated attributes. The plugin allows fine-grained control over various aspects of the cleanup task, which can smooth out the performance impact. For more information, see [Managing expired persistent grants in PingDirectory](pf_managing_expired_persis_grants_in_pd.html). |

## Related links

* [PingDirectory: Working with indexes](https://docs.pingidentity.com/pingdirectory/latest/pingdirectory_server_administration_guide/pd_ds_work_with_indexes.html)
