Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 Search Documentation | 2025.2

# Keep your index up to date

You can keep your P4 Server index up to date by using one of the following methods.

For more information on how to access Swagger P4 Search REST API, see API endpoints.

## Use Perforce Lua extensions

You must download and install the Perforce Lua extensions before you can use them to keep your index up to date. See Extension management endpoints in Swagger P4 Search REST API.

### Index individual changes

When a file is submitted you can automatically index it with Perforce indexer extension. Use the Perforce indexer extension with a Lua script to call the index change endpoint, see Index individual changes.

For more information on Lua extensions, see P4 Extensions Documentation.

### Remove obliterated files from the index

When a file is obliterated from the P4 Server, you can automatically remove it from the index with the Perforce obliterate extension. Use the Perforce obliterate extension with a Lua script to call the index obliterate endpoint, see Remove obliterated files from the index.

For more information on Lua extensions, see P4 Extensions Documentation

## Manually update the index

### Index individual changes

Index a specific change. This will create a new index if one does not exist or update an existing index.

GET http://localhost:1601/api/v1.2/index/change/<change_number>

#### Example

To index change number 917503, use the following curl request:

curl -H 'X-Auth-Token: <X-AUTH-TOKEN>' http://localhost:1601/api/v1.2/index/change/917503

Elasticsearch responds with:

"OK"

### Remove obliterated files from the index

When a file is obliterated from the P4 Server, this endpoint can be used to remove it from the index.

POST http://localhost:1601/api/v1.2/index/obliterate

#### Example

To remove the //streams-depot/main-stream-ProjB/Jenkinsfile and "depot/project2/NewScript1.m#2" files from the index:

    POST http://localhost:1601/api/v1/obliterate
    X-Auth-Token: <X-AUTH-TOKEN>
    Content-Type: application/json

    {
      "argsQuoted":"//streams-depot/main-stream-ProjB/Jenkinsfile,//depot/project2/NewScript1.m@12",
      "client":"super_proj",
      "clientcwd":"/Users/bruno/Workspaces/super_proj"
    }

Elasticsearch responds with:

"OK"

For information on removing individual files or the content of a directory, see Obliterate endpoint in Swagger P4 Search REST API.

## Write a cron job

You can write a cron job to keep the index up to date. The cron job can call the changes index endpoint with specific from and to change numbers, see Index endpoints in Swagger P4 Search REST API.

## Related topics

- API endpoints
- Data model

Your search for returned results