Query Index Block

Perform queries on ScoutOS indexes

The Query Index block enables users to perform search queries on specified ScoutOS indexes. It leverages Jinja templating to dynamically construct search terms and index IDs based on the workflow state. This block is essential for retrieving data from indexed collections within a ScoutOS workflow.

Configuration (Required)

Search Term
stringRequired

Search term to query. This field supports Jinja templating, allowing for dynamic search term construction based on the workflow state.

Index ID
stringRequired

Index ID to query. This field supports Jinja templating, enabling dynamic index ID generation based on the workflow state.

Limit
integer

Specifies the maximum number of results to return. The default value is 0, which indicates no limit.

See Workflow Logic & State > State Management for details on using dynamic variables in this block.

Outputs

The block outputs the search results from the queried index, formatted as a list. The output includes:

  • Response Format: JSON
  • Elapsed Time (ms): The time taken to perform the query in milliseconds.
  • Cost: The cost associated with the query execution.

Usage Context

Use this block to query data from ScoutOS indexes dynamically. It is particularly useful when you need to perform searches based on the current state of a workflow.

Best Practices

  • Ensure the search term and index ID are correctly formatted and valid: This helps in avoiding errors during query execution.
  • Utilize Jinja templating to dynamically generate search terms and index IDs: This allows for flexible and context-aware querying.
  • Handle potential exceptions such as network errors, timeouts, and unexpected response structures: Implement error handling to manage these scenarios effectively.