HCL Commerce Version 9.1.10.0 or later

Build an index and verify that the profit margin field is indexed

In this lesson, you build an index and verify that the profit margin field is indexed.

Procedure

To build the index and verify that the profit margin field is indexed, complete the following steps:
  1. Build the Search index.
    1. Issue the following command from within a REST client.
      POST: https://ingestServerHostname:ingestServerPort/connectors/auth.reindex/run?storeId=1
      Leave the Body empty, and use basic authentication with the username spiuser and the password spiuserPassword.
      Note:
      • The default password for the spiuser user is passw0rd for HCL Commerce 9.1.0.0 through 9.1.8.0, and QxV7uCk6RRiwvPVaa4wdD78jaHi2za8ssjneNMdu3vgqi for HCL Commerce 9.1.9.0 and greater.
      • It is essential to set your own spiuser password to secure your deployment. For more information, see Setting the spiuser password in your Docker images.

      In the example, the storeId is given as 1; replace this with the storeId for your own stores.

      The default values are:
      • AuroraESite: storeId=1
      • AuroraB2BSite: storeId=2
      • Emerald storeId=11
      • Sapphire storeId=12

      OR

      From a command prompt, issue the following command:

      curl --user spiuser:spi_plain_text_password --insecure -X POST "https://ingestServerHostname:ingestServerPort/connectors/auth.reindex/run?storeId=1"
      This call will return a runID value. For example:
      { "runId": "i-26144b4d-cd1c-4679-b2c2-870fc27e6095" }
    2. Wait for the index build to complete, or observe its status using its runID value.
      Issue the following GET REST command to obtain the build status.
      Use the returned value for runID from the previous step.
      GET http://ingestServerHostname:ingestServerPort/connectors/auth.reindex/runs/runId/status

      OR

      From a command prompt, issue the following command:
      curl --user spiuser:spi_plain_text_password --insecure -X GET "http://ingestServerHostname:ingestServerPort/connectors/auth.reindex/runs/runId/status"
      • If your build is in progress, a message similar to the following will provide details of its current status.
        {     "date": "2022-04-06T17:51:44.462",     "runId": "i-26144b4d-cd1c-4679-b2c2-870fc27e6095",     "fromType": "Ingest",     "message": "Indexing running, current progression of indexing is at process group: auth.reindex - WaitLink - Category Stage 1a",     "status": -1,     "progress": "30% (30 out of 101 pipes processed) " }
        Note: Progress percentage is a simple metric based on the number of pipes processed. It does not accurately reflect the progress in terms of time.
      • Once complete, a message similar to the following will detail the result of the completed build.
        "message": "Indexing run finished according to Nifi queue being empty for given connector. {\"start\":\"2022-04-06T17:50:17.821Z\",\"end\":\"2022-04-06T17:53:02.346Z\",\"run\":\"i-26144b4d-cd1c-4679-b2c2-870fc27e6095\",\"severities\":
        
        {\"I\":15,\"W\":2}
        ,\"codes\":{\"DI1002I\":14,\"DI1050W\":2},\"locations\":{\"warning\":
        
        {\"Others\":2}
        ,\"info\":{\"Others\":14,\"Price Stage 2, Copy Contract Prices\":1}},\"elapsed\":{\"absolute\":{\"connector\":164525,\"summary\":{\"Attribute Pipeline\":\"4548\",\"Catalog Pipeline\":\"5155\",\"Category Pipeline\":\"13956\",\"Price Pipeline\":\"2911\",\"Product Pipeline\":\"21389\",\"Store Pipeline\":\"25336\",\"URL 
        You can remove the /status at the end of the REST GET to obtain more detailed logs to review any encountered errors.
  2. Verify that the profit margin field is indexed.
    1. Using a REST client, issue the following POST commands to verify that the search index data are available.
      Product data: http://<ElasticSearchServerName>:30200/auth.<storeId>.product/_search
      • Ensure that the contents of the Body include the <storeId>, <languageId>, <catalogId>, and <catentryId>​.
      • Ensure that cost price data is available for the <catentryId> that you are using to verify that the profit margin field is indexed.
      • If you are connecting to the database for the production or live environment, replace “auth” with “live" in the POST command.
      
      {
          "query": {
              "term": {
                  "_id": "<storeId>-<languageId>-<catalogId>-<catentryId>"
              }
          }
      }
      In the following example:
      • storeId = 1
      • languageId = 1
      • catalogId = 10001
      • catentryId = 10001
      Example:
      {
          "query": {
              "term": {
                  "_id": "1--1-10001-10001"
              }
          }
      }
    2. Verify that the profit margin field is indexed as follows:
      
      "prices": {
      	"offer": {
      		"usd": 50.0
      	}
      	"list": {
      		"usd": 50.0
      	}
      	"10001": {
      		"usd": 50.0
      	}
      },
      "custom": {
      	"x_profitMargin": 19.0
      }