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

Steps to configure Web API settings

  1. From the application selector side menu (F2 or button top left) choose the Settings application.

  2. Go to Integration / Hawksearch and make sure under Indexing settings the Indexing type is set to Indexing API.

  3. On the same page you’ll find the settings for Indexing Api indexing under the category Indexing Api settings.

  4. Base indexing API Url - This is the base Hawksearch indexing API url, e.g. https://indexing-dev.hawksearch.net/api/v2/indexing

  5. 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.

  6. 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. https://bridgeline.atlassian.net/wiki/spaces/CON/pages/3468472066

  7. 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.

  8. 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.

  9. 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.

  10. 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

  1. From the application selector side menu (F2 or button top left) go to Custom/Hawksearch.

  2. Go to Indexing Api/Field mapping.

  3. Click New field mapping.

  4. Index name - Here you can choose the index previously defined in . This is the index on which the field will be created on.

  5. Type codename - Here you can choose the associated Kentico type for which you want this field to be. Previously defined in .

  6. 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.

  7. 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.

  8. 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.

  9. Include in results - This indicates whether the field will be included in result responses from Hawksearch.

  10. 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.

  11. 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 - .

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.