Defining your schema

Schemas are associated with datamarts by managing objects with the following properties:
// DRAFT Schema
"id": "1385",
"datamart_id": "1509",
"status": "DRAFT",
"creation_date": 1609888013947,
"last_modification_date": 1610443926552,
"publication_date": null,
"suspension_date": null
// LIVE Schema
"id": "1281",
"datamart_id": "1509",
"status": "LIVE",
"creation_date": 1603198414771,
"last_modification_date": 1603198415117,
"publication_date": 1603198415733,
"suspension_date": null
// ARCHIVED Schema
"id": "1276",
"datamart_id": "1509",
"status": "ARCHIVED",
"creation_date": 1603102827888,
"last_modification_date": 1603102828087,
"publication_date": 1603102828479,
"suspension_date": 1603102848269

Schema publication workflow

The process for publishing a schema is as follows:
  1. 1.
    Create a new schema definition
  2. 2.
    Upload the schema associated with the definition
  3. 3.
    Validate the schema
  4. 4.
    Publish the schema

Schema updates

After updating a schema, you can immediately use all its properties into the select part of your OTQL queries and any operator that doesn't require indexing.
If you add a new indexed property, only new elements going into your datamart will be indexed. You will be able to run WHERE queries and operators needing indexing, but your queries will not return values for elements already in your datamart. You can add a new indexed property by either adding a new property with @TreeIndex directive or adding the @TreeIndex directive to an existing property.
If you remove an indexed property, you will instantly stop being able to run WHERE queries and operators needing indexing for this query.
You can ask your mediarithmics contact to start a complete reindexing of your datamart if required

Manage schemas with mics CLI

You can use the MICS CLI to power up your schema definitions workflow.

Download a schema

Retrieve the LIVE schema or the specified one for a given datamart, and save it as a .gql file named schema-<DATAMARTID>-<SCHEMAID>.gql.
Use it to download the schema you want to start with, usually the current LIVE version.
$ mics-cli schema:fetch DATAMARTID [SCHEMAID]
DATAMARTID the ID of the datamart
SCHEMAID [default: LIVE] the ID of the schema, or LIVE to get the live schema
--stdout output the content of the file instead of saving it in a file
If you want to show the schema in the output, use the --stdout flag.

Update a schema

Create a draft, upload a file, validate it, and publish the schema with this all-in-one command.
Automatically handles status and cloning best practices:
  • If a draft schema already exists, update it before publishing.
  • Latest LIVE schema is cloned, if available, and --noClone flag is not set
You can keep your schema as a DRAFT and not publish it using the --skipPublishflag.
Get existing schemas
Archived schemas are displayed, meaning you can watch your history
Get a schema
Get the content of a schema
Create a DRAFT by cloning
This is the preferred method to create a DRAFT schema, as it will keep all settings from the previous version, like cluster versions, and index sizes.
Create a DRAFT without cloning
For the schema to keep initial settings—for example, elastic search version, and index size—you need to clone the previous LIVE version. Only use this endpoint if you know the required settings and you can set them up before publishing.
Upload the content
Validate a DRAFT schema
Publish a schema