Mapping API Examples

Use this API to create and maintain custom facets sort order on search and landing pages.

Following operations are provided by Hawksearch mapping API:

Upsert to add new or update existing mappings

View Mappings to list the mappings in a json format

 

General Notes:

Ensure that the header contains the Hawksearch Key for all the operations:
Request headers must contain the Hawksearch API Key as follows:
Format: X-HawkSearch-ApiKey : <your engine API key>
Example: X-HawkSearch-ApiKey : 12345678-9ABC-DEF0-1234-56789ABCDEF0


Upsert the mapping in a POST request

POST /api/mapping/upsert { "indexName": "elasticdemo.20210903.113840", "Mappings": [ { "Field": "size-property", "Label": "Extra Small", "Value": "Extra Small", "SortOrder": 1 }, { "Field": "size-property", "Label": "Small", "Value": "Small", "SortOrder": 2 }, { "Field": "size-property", "Label": "Medium", "Value": "Medium", "SortOrder": 3 }, { "Field": "size-property", "Label": "Large", "Value": "Large", "SortOrder": 4 } ] }

 


Below API request lists the mappings

POST /api/mapping/ { "indexName": "elasticdemo.20210903.113840", "Field":"size-property" }

 

API Response

[ { "Mapping": { "Field": "size-property", "Label": "Large", "SortOrder": "4" }, "Field": "size-property", "Value": "Large" }, { "Mapping": { "Field": "size-property", "Label": "Small", "SortOrder": "2" }, "Field": "size-property", "Value": "Small" }, { "Mapping": { "Field": "size-property", "Label": "Medium", "SortOrder": "3" }, "Field": "size-property", "Value": "Medium" }, { "Mapping": { "Field": "size-property", "Label": "Extra Small", "SortOrder": "1" }, "Field": "size-property", "Value": "Extra Small" } ]

Â