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 on the pencil icon for the Product entity.
- Click the + button below Properties to add a new row.
- Click in the area just below the key icon to make this row the primary key.
- Type in sku as the Name.
- Change the Type to string.
- Click the + button below Properties to add a new row.
- Type in price as the Name.
- Change the Type to decimal.
- Click the SAVE button.
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.