Kentico: Indexing API Overview
In this article you’ll find:
Goal
The goal of this article is to show how to create field mappings which drive the Indexing Api indexing as well as give you some information on how it works.
Overview
The way the Indexing API indexing works is you define field mappings which contain all the information necessary to map your database information to a Hawksearch index. When you specify which index mapping you want the field to be on, whenever that index gets recreated and rebuilt the Hawksearch Name for it will be updated to match the newly created index.
Prerequisites
Created Index Mappings - Kentico: Manage indexes
Configured connector - Kentico: System Settings Setup
Steps to configure Web API settings
From the application selector side menu (F2 or button top left) choose the Settings application.
Go to Integration / Hawksearch and make sure under Indexing settings the Indexing type is set to Indexing API.
On the same page you’ll find the settings for Indexing Api indexing under the category Indexing Api settings.
Base indexing API Url - This is the base Hawksearch indexing API url, e.g. https://indexing-dev.hawksearch.net/api/v2/indexing
Use deferred indexing - Whether deferred indexing will be used or not. Deferred indexing delays the deletion and swapping of the index until after the new index has been created and rebuilt.
Use multisource indexing - Whether multisource indexing will be used or not. Multisource indexing queries a predefined set of data sources to begin indexing alongside the local source. Kentico: Multisource indexing: Setup
Use permission filtering - Whether permission filtering will be used when generating the index and when searching. If enabled, a new field called permissions is added to each document that is made from a page node while indexing. When searching using the widgets, the current authenticated user’s role ids are sent to Hawksearch so only authorized results are brought back. Kentico: Filter by permissions: Setup
Enable index trace logging - Whether trace logging will be enabled for indexing requests. If enabled, a message is logged in the event log for each request and response.
Enable search trace logging - Whether trace logging will be enabled for search requests. If enabled, a message is logged in the event log for each request and response.
Field types - a semicolon separated list of page / module class / custom table code names, used to determine what gets included in the index.
Steps to create a field mapping
From the application selector side menu (F2 or button top left) go to Custom/Hawksearch.
Go to Indexing Api/Field mapping.
Click New field mapping.
Index name - Here you can choose the index previously defined in Kentico: Manage indexes. This is the index on which the field will be created on.
Type codename - Here you can choose the associated Kentico type for which you want this field to be. Previously defined in Kentico: System Settings Setup.
Field type - Here you can choose the type of the field. You can choose between Unique Identifier, Text, Number, Boolean, Date, GeoPoint. Each indexed object needs to have exactly one Unique Identifier.
Hawksearch field - This is the name of the field as seen in Hawksearch. When you write the field name for a Unique Identifier field type, make sure the field type already exists in Hawksearch and is marked as a primary key. By default the Hawksearch field name “id” is set as a primary key.
Source column name - This is the name of the database column from which you want to take the value from. For example if you’re indexing a page type you can write “DocumentID” for the Unique Identifier field. Keep in mind though, if you’re indexing multiple different types of objects (documents, module classes and tables) it’s better to use their respective GUID values instead of the table row ID since there can be overlaps and they need to be unique.
Include in results - This indicates whether the field will be included in result responses from Hawksearch.
JSON Property - For the designated field, if it contains a JSON object, you can pinpoint a specific property. Only valid properties that are one level deep will be stored as a string; otherwise, the entire JSON object will be stored.
Ex: For a field being sent to HawkSearch in the format{“a“ : ”A value”, “b“ : “B value“}
, if you specify “a” in the JSON Property Field setting, only the “A value” will be transmitted to HawkSearch for that particular field.Click save.
How to run an Indexing API reindexing?
The reindexing is run by a scheduled task that is added for each specific index. Learn how to add and configure it here - Kentico: Creating the Indexing Scheduled task .
Once you have added and configured the scheduled task, it will run automatically on the predefined timing that you have set. If you want to run it manually, find the created task and press the green play button in order to execute it now regardless of its scheduling settings.
You will be notified when the indexing has finished in the event log along with any errors that may have occurred.