Create an Entity Using Gradle

You must create an entity before you can define the mappings between your source data and the publicly accessible data.

Before you begin

You need:

Procedure

  1. Open a command-line window, and go to your project root directory.
  2. At your project root, run the Gradle task hubCreateEntity.
    ./gradlew hubCreateEntity -PentityName=your-entity-name -igradlew.bat hubCreateEntity -PentityName=your-entity-name -i
  3. Edit the new entity definition in your-project-root/entities/your-entity-name.entity.json.
    Important: By default, the entity type name is added to its file name at your-entity-name.entity.json. In the file, the entity type name is used for the entity type definition name and the value of $.info.title.

    If you plan to use Hub Central, the file name, entity type definition name, and value of $.info.title must use the same entity type name. Otherwise, you will be unable to view the properties for that entity type in Hub Central.

    Range indexes can be configured in entity definitions to improve performance. Learn more: Indexing in MarkLogic