Index endpoints

This section details the Helix Search indexing endpoints.

Indexing changes

Description

POST http://localhost:1601/api/v1.1/index/changes

Indexes changes in the Helix server by creating a thread pool of specified number of threads, see Set the maximum threads used for indexing . Displays the total number of changes found from newest to oldest.

Fields

All fields are optional,

  • depotFile: depot path to index, defaults to //...
  • from: Helix server change number
  • to: Helix server change number
  • user: Helix server user
  • force: determines whether existing indexed changes are re-indexed
    • false: skips changes that have already been indexed, defaults to false
    • true: will update existing changes

Example usage

To limit the index to //depot/...:

curl -H "X-Auth-Token: <YOUR-AUTH-TOKEN>" -X POST -d '{"depotFile":"//depot/..."}' http://localhost:1601/api/v1.1/index/changes

Helix Search responds with the number of changes found:

{
  "status": {
    "code": 200,
    "message": "OK"
  },
  "data": [
    {
      "size": 256
    }
  [
}

Index a specified change

Description

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

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

Usage example

To index a change number 917503:

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

Helix Search responds with:

{
  "status": {
    "code": 200,
    "message": "OK"
  },
  "data": [
    {
      "OK"
    }
  [
}

Remove obliterated files from the index

Description

POST http://localhost:1601/api/v1.1/index/obliterate"

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

Usage examples

Remove a single file

To remove the "depot/project2/NewScript1.m#2" file from the index:

POST http://localhost:1601/api/v1.1/obliterate
X-Auth-Token: <YOUR-AUTH-TOKEN>
Accept: application/json
 
{
  "argsQuoted": "//depot/project2/NewScript1.m#2",
  "client": "project_2",
  "clientcwd": "/Users/bruno/Workspaces/project2/"
}

Remove multiple files

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.1/obliterate
X-Auth-Token: <YOUR-AUTH-TOKEN>
Accept: application/json
 
{
  "argsQuoted":"//streams-depot/main-stream-ProjB/Jenkinsfile,//depot/project2/NewScript1.m@12",
  "client":"super_proj",
  "clientcwd":"/Users/bruno/Workspaces/super_proj"
}

Remove the content of a directory

To remove all of the files in "//p4-python/main/utils/..." from the index:

POST http://localhost:1601/api/v1.1/obliterate
X-Auth-Token: <YOUR-AUTH-TOKEN>
Accept: application/json
 
{
  "argsQuoted": "//p4-python/main/utils/...",
  "client": "myproject",
  "clientcwd": "/Users/bruno/Workspaces/p4-demo"
}

Check indexing progress

Description

GET http://localhost:1601/api/v1.1/index/progress

Returns the number of changes have been processed compared to the total number of changes.

Example usage

To check the indexing progress:

curl -H "X-Auth-Token: <YOUR-AUTH-TOKEN>" http://localhost:1601/api/v1.1/index/progress

Helix Search responds with:

{
  "status": {
    "code": 200,
    "message": "OK"
  },
  "data": [
    {
      "progress": "458:847"
    }
  [
}

Clear index queue

Description

GET http://localhost:1601/api/v1.1/index/reset

Clears the index queue.

Example usage

To clear the index queue:

curl -H "X-Auth-Token: <YOUR-AUTH-TOKEN>" http://localhost:1601/api/v1.1/index/reset

Helix Search responds with:

{
  "status": {
    "code": 200,
    "message": "OK"
  }
}

Check thread status

Description

GET http://localhost:1601/api/v1.1/index/status

Returns details for of each of the running threads while indexing is in progress.

Example usage

To display the thread information:

curl -H "X-Auth-Token: <YOUR-AUTH-TOKEN>" http://localhost:1601/api/v1.1/index/status

Helix Search responds with:

{
  "status": {
    "code": 200,
    "message": "OK"
  },
  "data": [
    {
      "thread-status": [
        {
          "taskID": "change-793497",
          "state": "STARTED",
          "time": "Apr 7, 2020 10:51:15 AM",
          "duration": 0
        },
        ...
      ]
    }
  [
}

Show completed threads

Description

GET http://localhost:1601/api/v1.1/index/completed

Returns details for of each of the completed threads while indexing is in progress.

Usage example

To display the thread information:

curl -H "X-Auth-Token: <YOUR-AUTH-TOKEN>" http://localhost:1601/api/v1.1/index/completed

Helix Search responds with:

{
  "status": {
    "code": 200,
    "message": "OK"
  },
  "data": [
    {
      "thread-status": [
        {
          "taskID": "change-917326",
          "state": "COMPLETED",
          "time": "Apr 7, 2020 11:12:52 AM",
          "duration": 93
        },
        ...
      ]
    }
  [
}

Check last indexed time

Description

GET http://localhost:1601/api/v1.1/index/lastindexed

Returns the time Helix server was last indexed.

Example usage

To check the last index time:

curl -H "X-Auth-Token: <YOUR-AUTH-TOKEN>" http://localhost:1601/api/v1.1/index/lastindexed

Helix Search responds with:

{
  "status": {
    "code": 200,
    "message": "OK"
  },
  "data": "Unavailable",
  "indexDate": 1621500293546,
  "productVersion": "unspecified"
}