Rebuild Indexes
Important
Disambiguation: Depending on the version of HawkSearch used, method of integration, and the presence of data feed files for indexing, you may need to perform indexing as per this article or Hawksearch v4.0 - Indexing API. Please contact HawkSearch for any clarifications.
Overview
This API allows you to trigger an index rebuild job in Hawksearch dashboard.
Rebuild Index
Rebuild Full Index
Request
POST request with empty body to the API below:
POST /api/v10/index HTTP/1.1
Host: dashboard-na.hawksearch.com
X-HawkSearch-ApiKey: USE_YOUR_API_KEY
Cache-Control: no-cache
{}
Rebuild Index with Arguments - Only exists in dev environment
Request
POST request with empty body to the API below:
POST /api/v10/index/trigger HTTP/1.1
Host: dev.hawksearch.net
X-HawkSearch-ApiKey: USE_YOUR_API_KEY
Cache-Control: no-cache
{
"args":"partial"
}
Response
The response is an array of string objects, every object being a series of key-value pairs. Description of the data is as follows:
No | Key | Description | Value Type |
---|---|---|---|
1 | NotificationId | The unique identifier asssigned to the index rebuild request made | Number |
2 | Title | Task name | String Example: Requested Re-Indexing (API) |
3 | Message | Response message from the server | String Example: Requested Re-Indexing (API) |
4 | NotificationType | Indicates whether this was indexing related or not | String Example: indexing |
5 | Status | The current indexing status | One of the 8 possible values: new, pending, processing, queue, success, error, duplicated, suspended |
6 | AdminId | Admin account id from which the index rebuild request was raised | Numeric |
7 | Provider | Indexing provider - this is debugging info used by HawkSearch | Alphanumeric |
8 | FacetHandler | Internal handler associated with the field | Alphanumeric |
9 | Serialized | Serialized object | Alphanumeric |
10 | ErrorMessages | Error messages associated with the rebuild job | Alphanumeric |
11 | Args | Optional list of custom arguments | List of key value pair list Example: “arg_name“:”arg_value” |
{
"NotificationId": 122924,
"Title": "Requested Re-Indexing (API)",
"Message": "Requested Re-Indexing (API)",
"NotificationType": "indexing",
"Status": "new",
"AdminId": 113,
"Provider": "Contracts.IndexNotification",
"Serialized": "CgsIhuSGoufqtzkQBRIECAEQDyIuChJSZXF1ZXN0ZWQgSW5kZXhpbmcSCwiG5Iai5+q3ORAFGgsIhuSGoufqtzkQBQ==",
"ErrorMessages": null,
"Args": {
"indextype": "partial"
}
}
Best Practices to Rebuild Index
Some best practices before sending an index rebuild request
-
When sending a new index rebuild request, it is always a good idea to check if the previous request has finished processing.
To check this, send a GET request to the URL https://dev.hawksearch.net/api/v10/index/status with the additional header parameter
X-HawkSearch-ApiKey: YOUR_API_KEY
curl --location --request GET 'https://dev.hawksearch.net/api/v10/index/status' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'X-HawkSearch-ApiKey: YOUR_API_KEY'
The status can be considered incomplete if it is one of these cases -
New
,Pending
,Processing
,Queue
so please wait before sending another index rebuild request. If a new index rebuild request is sent while the current task isn’t complete, the new request is marked “duplicate” without being processed.
The status can be considered as done if it is one of these cases -Success
,Error
,Duplicated
,Suspended
in which case the new/updated index will be usable and further requests to rebuild are accepted.{ "Status": "queue", "Count": 0, "Duration": "00:00:00", "StartDateTime": "03-25-2021", "EndDateTime": null, "TimeZone": "Central Standard Time" }
-
The status of a specific
NotificationId
can also be by appending the value of the NotificationId to the above request https://dev.hawksearch.net/api/v10/index/status/{{NotificationId}}
Manage Definition
Rebuild Definition to confirm the set of fields created.
This request needs to be run after creating, updating, deleting one or more fields.
curl --location --request POST 'https://dev.hawksearch.net/api/v10/definition/' \
--header 'Content-Type: application/json' \
--header 'X-HawkSearch-ApiKey: YOUR_ENGINE_API_KEY'
Triggers re-generating index definition file on demand
Parameters
- param: No Documentation Found. (FromBody)
Updated over 1 year ago