Object indexing

Object indexing imports objects from your integration into the SquaredUp graph, making them available throughout the platform for searching, scoping, drilldowns, and RollUp-style dashboards.

How object indexing works

Each indexing definition contains one or more import steps. Each step:

  1. Calls a data stream
  2. Reads the returned rows
  3. Maps those rows into graph objects
  4. Imports those objects into SquaredUp

This allows you to transform almost any external dataset into indexed objects that can participate in the SquaredUp object graph.

Typical objects include hosts, virtual machines, applications, services, Kubernetes resources, and users.

Index definition location

Index definitions live in the indexDefinitions/ folder of your plugin.

By convention this file is named default.json, but any filename works: SquaredUp loads every .json file in the folder, and each becomes a separate import definition.

Note

The folder is named indexDefinitions in the plugin structure, but SquaredUp's own code and tooling still refer to these as importDefinitions. That name is still current internally, just not the folder name in your plugin package.

Example index definition

{
  "steps": [
    {
      "name": "Import vehicles",
      "dataStream": {
        "name": "vehicles",
        "id": "datastream-xxxxxxxxxx",
        "config": {}
      },
      "timeframe": "none",
      "objectMapping": {
        "id": "name",
        "name": "name",
        "type": { "value": "starwars-vehicle" },
        "properties": [
          "model",
          "manufacturer",
          "vehicle_class",
          { "vehicleId": "name" },
          { "crewCount": "crew" },
          { "maxSpeed": "max_atmosphering_speed" },
          { "owner": { "value": "Disney" } }
        ]
      }
    }
  ],
  "frequencyMinutes": 720
}

Configure object indexing

Configure object indexing in the Configure indexing window. To open it, click More options

> Configure indexing on the data source overview page.

Parameters

Parameter
Description
Indexing frequency (minutes)
Specify how often the indexing process should run. This controls how frequently objects are imported and updated in the SquaredUp graph. Defaults to 720 minutes (12 hours).
Index steps
Configure one or more import steps which define how data streams are queried and mapped into graph objects. Each step imports a specific object type or dataset into SquaredUp. See Object indexing for the full schema.

Import objects that depend on other objects

Some objects can only be fetched once you know their parent. For example, an API might list datasets per project, so you need the projects before you can ask for their datasets. Add dependsOn to a step to make it wait for other steps, then scope it to the objects those steps imported.

Note

When nesting object steps, build and test one level at a time. A scoped data stream can only be tested once its parent objects have been indexed, so import the parents first, then add the next step.

How dependent steps run

A step with no dependsOn is a root step and runs as soon as the import starts. A step that lists other steps in dependsOn waits until every one of them finishes with a status of succeeded or warning. A step can depend on several steps, and chains can be as deep as you need.

The dependent step uses scope.query to select the objects imported by the earlier step, and its data stream then runs for those objects. Reference the scoped object with {{object.rawId}} in the data stream's endpointPath, or with context.objects[0] in a script.

dependsOn controls run order and scope only. It doesn't create relationships between the parent and child objects.

Set up a dependent step

  1. Add a step that imports the parent objects, such as projects.
  2. Add a second step whose data stream fetches the child objects for one parent, using {{object.rawId}} in its endpointPath.
  3. Set scope.query on the second step to select the parent objects, for example g.V().has("sourceType", "Project").
  4. Set dependsOn on the second step to the name of the first step.

In this example, the datasets step waits for projects, then calls projects/{{object.rawId}}/datasets once for each imported project:

{
  "steps": [
    {
      "name": "projects",
      "dataStream": {
        "name": "listProjects"
      },
      "timeframe": "none",
      "objectMapping": {
        "id": "id",
        "name": "displayName",
        "type": {
          "value": "Project"
        },
        "properties": [
          "organizationId",
          "studioHost",
          "createdAt"
        ]
      }
    },
    {
      "name": "datasets",
      "dataStream": {
        "name": "datasets"
      },
      "scope": {
        "query": "g.V().has(\"sourceType\", \"Project\")"
      },
      "timeframe": "none",
      "objectMapping": {
        "id": "uid",
        "name": "displayName",
        "type": {
          "value": "Dataset"
        },
        "properties": [
          "datasetId",
          "aclMode",
          "createdAt",
          "createdByUserId",
          "projectId"
        ]
      },
      "optional": true,
      "dependsOn": [
        "projects"
      ]
    }
  ]
}

What happens when a step fails

If a step that another step depends on fails or is cancelled, the dependent step is skipped with the message Skipped: dependency '<name>' did not succeed. The skip cascades, so any steps that depend on the skipped step are skipped too.

Set optional to true on a step whose failure shouldn't stop the import. If an optional step fails, it's recorded as a warning instead of failing the import, and steps that depend on it still run.

Validation rules

SquaredUp checks the steps when the plugin loads, and rejects an index definition that has:

  • Two steps with the same name
  • A dependsOn entry naming a step that doesn't exist
  • A step that depends on itself
  • A cycle, such as two steps that depend on each other

Properties

ImportDefinition properties

Property
Type
Description
steps
array
The import steps to run
frequencyMinutes
number (optional)
Time between imports in minutes. Defaults to 720 (12 hours)

ImportStepDefinition properties

Property
Type
Description
name
string
Human-readable label for logging
dataStream.name
string
The data stream to read from
dataStream.config
object (optional)
Data source config passed to the stream
dataStream.group / dataStream.sort
object (optional)
Grouping and sorting applied to the data stream results. Easiest to copy from tile config
scope
object (optional)
A graph query to limit which objects are in scope for this import step. Easiest to copy from the SquaredUp UI when configuring indexing
timeframe
string
Timeframe for the data stream call, for example "last24Hours" or "none"
objectMapping
object
How to convert rows into graph objects
dependsOn
string[] (optional)
Names of the steps that must finish with a status of succeeded or warning before this step runs. Leave empty for a step that runs as soon as the import starts
optional
boolean (optional)
When true, a failure of this step is recorded as a warning instead of failing the import, and steps that depend on it still run

objectMapping properties

Property
Description
id
Column name containing a unique object ID
name
Column name containing the display name
type
Either a column name (string) or a fixed value ({ "value": "myType" })
properties
Additional columns to include as object properties — see example above for the various formats

Indexing tips

  • Use multiple steps to import different object types, for example one step for hosts and one for services.
  • Mark data streams used only for indexing with "visibility": { "type": "hidden" } so they don't appear in the tile editor.
  • SquaredUp always builds each object's internal ID by combining its type and id from your objectMapping. Your original, unprefixed id value is kept automatically as a rawId property, and the plugin config ID is separately folded in to guarantee the object is unique across the whole organization. There's no need to add your own raw ID property.

Was this article helpful?


Have more questions or facing an issue?