Getting Started Tutorial 2.x
Modeling the Product Entity

Modeling the Product Entity

After browsing the data and speaking to our Data Guru we now know that we want to harmonize two very specific fields: sku and price.

sku

Sku is the unique identifier for each type of product. In our raw data sku is stored in two different fields: sku and SKU. We must harmonize the two into a common sku field so that searching over sku is easier.

price

Price is stored as a string during the raw ingest. We want to convert it to a decimal so that we can do arithmetic on it.

Let’s get started by modeling our Entity. Click on the Entities tab in the top navigation bar.

Click Entities Tab

  1. Click on the pencil icon for the Product entity.
  2. Click the + button below Properties to add a new row.
  3. Click in the area just below the key icon to make this row the primary key.
  4. Type in sku as the Name.
  5. Change the Type to string.

Edit Entity

  1. Click the + button below Properties to add a new row.
  2. Type in price as the Name.
  3. Change the Type to decimal.
  4. Click the SAVE button.

Edit Entity

After clicking Save you will be prompted whether you want to Update Indexes in MarkLogic or not.

Click YES.

One of the benefits of modeling your data with Entity Services is that you can use the model to create database configuration options automatically. This means you can update the necessary index settings bases on how you model your data. For the Product entity, you made sku the primary key. The Data Hub Framework will create a range index on the sku element.

Update Indexes

Up Next

Harmonizing the Product Data