Keep your index up to date

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

Tip

For more information on how to access Swagger Helix 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 Helix 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 Helix Core Extensions Developer Guide.

Remove obliterated files from the index

When a file is obliterated from the Helix 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 Helix Core Extensions Developer Guide

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 Helix 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 Helix 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 Helix Search REST API.

Related topics