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 9.1.0.0 through 9.1.8.0, and QxV7uCk6RRiwvPVaa4wdD78jaHi2za8ssjneNMdu3vgqi for 9.1.9.0 and greater.
      • It is essential to set your own spiuser password to secure your deployment. For more information, see ../../install/tasks/tiginstall_definespi.html.

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