Configure a Data Model

Data models simplify the process of getting started with Fusion by providing pre-configured objects to reduce the effort spent on basic starting tasks. This helps keep documents consistent between datasources and intuitive to the object’s type.

The instructions below use the Slack connector to create the datasource, which includes messages and users. The index pipeline use the person data model to index the users.

1. Configure the datasource

  1. Navigate to Indexing > Datasources.

  2. Click the Add button, and choose the Slack connector from the list.

    Note
    Some connectors include built-in data models as a standard component. Others require you to manually create data models.
  3. Complete the datasource configuration:

    • Ideally, use a pipeline specifically created for this data model. For now, you can create the pipeline by navigating to Indexing > Index Pipelines and clicking the Add button. Configure it later as described below.

    • Under Limit Documents, choose Public Channels and Index Profiles:

      Limit documents

  4. Click Save.

  5. Click Run to run the indexing job.

2. Configure the data model

Some connectors include built-in data models with pre-configured object types. However, you can add new data models or customize existing ones to fit your particular needs.

  1. Navigate to Indexing > Data Models.

  2. Click the Add button.

  3. Create a new data model, person.

  4. Assign the index pipeline you used when configuring the datasource, companyDirectory-index-pipeline.

  5. Assign the query pipeline you will use to query the indexed documents. In this example, create a new query pipeline named companyDirectory-query-pipeline.

  6. Click the New button under Fields Configuration.

  7. Complete the required configurations, as detailed in Data Models API Reference. Create fields for the following:

    Field Name Solr Fields

    first_name

    firstName_t, firstName_s

    last_name

    lastName_t, lastName_s

    email

    email_s

    job_title

    jobTitle_t, jobTitle_s

    Data Models Person

  8. Click the Save button to save the data model.

3. Configure the index pipeline

To begin, navigate to Indexing > Index Workbench. Alternatively, the companyDirectory-index-pipeline pipeline can be configured in Indexing > Index Pipelines, but you are not able to preview results.

Important
The raw data fields in your index coming from Slack may differ from the example data fields used in this article.

3.1. Data Model Mapping stage

  1. Click the Add a Stage button, and choose Data Model Mapping from the list.

  2. Use the Data Model Type dropdown to select the person data model.

  3. (optional) Check the Match Trigger checkbox and assign the following values:

    Field Value

    Field to match

    type_s

    Value to match

    user

    Tip
    The Value to match field supports RegEx. You can assign multiple values. Alternatively, you can create additional Data Model Mapping stages.
  1. Assign field mappings for the Slack datasource’s raw datasources. :

    Source Field Data Model Field

    first_name

    first_name

    last_name

    last_name

    email

    email

  2. (optional) Check the Keep unmapped fields checkbox to preserve fields that are unmatched to the data model.

  3. Click Apply.

3.2. Call Data Model Pipeline stage

Important
This stage must be placed after the Data Model Mapping stage.
  1. Click the Add a Stage button, and choose Call Data Model Pipeline from the list.

  2. Assign the value _lw_data_model_type_s to the Data Model Type Field field. This field is created when a document meets the criteria specified in the Data Model Mapping.

  3. Click Apply.

Next steps

With the index pipeline configured, you are now ready to complete the indexing job by clicking the Start Job button.

Once complete, the documents are ready for viewing in the Query Workbench:

  1. Navigate to Querying > Query Workbench.

  2. Click the Load button.

  3. Choose the query pipeline you specified when creating the data model, companyDirectory-query-pipeline.