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:

NoKeyDescriptionValue Type
1NotificationIdThe unique identifier asssigned to the index rebuild request madeNumber
2TitleTask nameString

Example: Requested Re-Indexing (API)
3MessageResponse message from the serverString

Example: Requested Re-Indexing (API)
4NotificationTypeIndicates whether this was indexing related or notString

Example: indexing
5StatusThe current indexing statusOne of the 8 possible values:

new, pending, processing, queue, success, error, duplicated, suspended
6AdminIdAdmin account id from which the index rebuild request was raisedNumeric
7ProviderIndexing provider - this is debugging info used by HawkSearchAlphanumeric
8FacetHandlerInternal handler associated with the fieldAlphanumeric
9SerializedSerialized objectAlphanumeric
10ErrorMessagesError messages associated with the rebuild jobAlphanumeric
11ArgsOptional list of custom argumentsList 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

  1. 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"
    }
    
  2. 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)