This is a cache of https://docs.openshift.com/serverless/1.34/serverless-logic/serverless-logic-supporting-services/serverless-logic-data-index.html. It is a snapshot of the page at 2024-11-22T16:36:02.182+0000.
Data Index <strong>service</strong> - Supporting <strong>service</strong>s | Serverless Logic | Red Hat OpenShift Serverless 1.34
×

The Data Index service is a dedicated supporting service that stores the data related to the workflow instances and their associated jobs. This service provides a GraphQL endpoint allowing users to query that data.

The Data Index service processes data received through events, which can originate from any workflow or directly from the Job service.

Data Index supports Apache Kafka or Knative Eventing to consume CloudEvents messages from workflows. It indexes and stores this event data in a database, making it accessible through GraphQL. These events provide detailed information about the workflow execution. The Data Index service is central to OpenShift Serverless Logic search, insights, and management capabilities.

The key features of the Data Index service are as follows:

  • A flexible data structure

  • A distributable, cloud-ready format

  • Message-based communication with workflows via Apache Kafka, Knative, and CloudEvents

  • A powerful GraphQL-based querying API

When you are using the OpenShift Serverless Operator to deploy workflows, you do not need to manually install or configure the Data Index service. The Operator automatically manages all the necessary configurations for each workflow to connect with it.

GraphQL queries for workflow instances and jobs

To retrieve data about workflow instances and jobs, you can use GraphQL queries.

Retrieve data from workflow instances

You can retrieve information about a specific workflow instance by using the following query example:

{
  ProcessInstances {
    id
    processId
    state
    parentProcessInstanceId
    rootProcessId
    rootProcessInstanceId
    variables
    nodes {
      id
      name
      type
    }
  }
}

Retrieve data from jobs

You can retrieve data from a specific job instance by using the following query example:

{
  Jobs {
    id
    status
    priority
    processId
    processInstanceId
    executionCounter
  }
}

Filter query results by using the where parameter

You can filter query results by using the where parameter, allowing multiple combinations based on workflow attributes.

Example query to filter by state
{
  ProcessInstances(where: {state: {equal: ACTIVE}}) {
    id
    processId
    processName
    start
    state
    variables
  }
}
Example query to filter by ID
{
  ProcessInstances(where: {id: {equal: "d43a56b6-fb11-4066-b689-d70386b9a375"}}) {
    id
    processId
    processName
    start
    state
    variables
  }
}

By default, filters are combined using the AND Operator. You can modify this behavior by combining filters with the AND or OR operators.

Example query to combine filters with the OR Operator
{
  ProcessInstances(where: {or: {state: {equal: ACTIVE}, rootProcessId: {isNull: false}}}) {
    id
    processId
    processName
    start
    end
    state
  }
}
Example query to combine filters with the AND and OR Operators
{
  ProcessInstances(where: {and: {processId: {equal: "travels"}, or: {state: {equal: ACTIVE}, rootProcessId: {isNull: false}}}}) {
    id
    processId
    processName
    start
    end
    state
  }
}

Depending on the attribute type, you can use the following avaialable Operators:

Attribute type Available Operators

String array

  • contains: String

  • containsAll: Array of strings

  • containsAny: Array of strings

  • isNull: Boolean (true or false)

String

  • in: Array of strings

  • like: String

  • isNull: Boolean (true or false)

  • equal: String

ID

  • in: Array of strings

  • isNull: Boolean (true or false)

  • equal: String

Boolean

  • isNull: Boolean (true or false)

  • equal: Boolean (true or false)

Numeric

  • in: Array of integers

  • isNull: Boolean

  • equal: Integer

  • greaterThan: Integer

  • greaterThanEqual: Integer

  • lessThan: Integer

  • lessThanEqual: Integer

  • between: Numeric range

  • from: Integer

  • to: Integer

Date

  • isNull: Boolean (true or false)

  • equal: Date time

  • greaterThan: Date time

  • greaterThanEqual: Date time

  • lessThan: Date time

  • lessThanEqual: Date time

  • between: Date range

  • from: Date time

  • to: Date time

Sort query results by using the orderBy parameter

You can sort query results based on workflow attributes by using the orderBy parameter. You can also specify the sorting direction in an ascending (ASC) or a descending (DESC) order. Multiple attributes are applied in the order you specified.

Example query to sort by the start time in an ASC order
{
  ProcessInstances(where: {state: {equal: ACTIVE}}, orderBy: {start: ASC}) {
    id
    processId
    processName
    start
    end
    state
  }
}

Limit the number of results by using the pagination parameter

You can control the number of returned results and specify an offset by using the pagination parameter.

Example query to limit results to 10, starting from offset 0
{
  ProcessInstances(where: {state: {equal: ACTIVE}}, orderBy: {start: ASC}, pagination: {limit: 10, offset: 0}) {
    id
    processId
    processName
    start
    end
    state
  }
}