HCL Commerce Version 9.1.10.0 or later

Customize the user data field name mapping and search configuration to include custom data

In this lesson, you modify the user data field name mapping to map the profit margin field to user data using the configuration API. You also create a search profile using the configuration API.

About this task

To map the user data field and create a profile, use the following Query service API and a REST client.

Procedure

To customize the user data field name mapping and search configuration to include custom data, complete the following steps:
  1. Modify the user data field name mapping to map the profit margin field to user data using the configuration API.
    1. Restart Query service
    2. From the REST client issue the following command:
      POST: http://ElasticSearchServer:30920/search/resources/api/v2/configuration?nodeName=component&envType=auth
      HCL Commerce Version 9.1.6.0 or laterNote:
      • Use envType as auth (if using an authoring environment) or live (if using a production environment).
      • Use basic authentication with the user name as spiuser and password as passw0rd for HCL Commerce 9.1.0.0 to 9.1.8.0, or QxV7uCk6RRiwvPVaa4wdD78jaHi2za8ssjneNMdu3vgqi for HCL Commerce 9.1.9.0 or greater.
    3. For the API body, use the following code:
      {
          "valuemappingservice": {
              "valuemapping": [
                  {
                      "internalName": "CatalogEntryUserDataFieldNameMapping",
                      "externalName": "CatalogEntryUserDataFieldNameMapping",
                      "valuemap": [
                          {
                              "externalValue": "ProfitMargin",
                              "internalValue": "custom.x_profitMargin"
                          }
                      ]
                  }
              ]
          }
      }
      
    4. Click Send request. The configuration is added for the component.
    5. Restart the Query service.
  2. Create a search profile using the configuration API.
    1. From the REST client issue the following command:
      POST: http://ElasticSearchServer:30920/search/resources/api/v2/documents/profiles/X_findCatalogEntryProfitMargin

      Use basic authentication with the user name as spiuser and password as passw0rd for HCL Commerce 9.1.0.0 to 9.1.8.0, or QxV7uCk6RRiwvPVaa4wdD78jaHi2za8ssjneNMdu3vgqi for HCL Commerce 9.1.9.0 or greater.

    2. For the API body, use the following code:
      {
      	"parentProfileName": "IBM_findProductByIds_Summary",
      	"profileName": "X_findCatalogEntryProfitMargin",
      	"query": {
      		"responseFields": [
      			"custom.x_profitMargin"
      		]
      	}
      }
      
    3. Click Send request. The search profile is created successfully.
    4. Restart the Query service.
    5. Using a REST client, issue the following REST service call to verify that the profile margin data is returned (using profileName=X_findCatalogEntryProfitMargin).
      http://((QS Server)):((QS Port))/search/resources/store/1/productview/byId/10001?profileName=X_findCatalogEntryProfitMargin