> For the complete documentation index, see [llms.txt](https://docs.streambased.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.streambased.io/deploy-and-operate/streambased-platform/hyperstream/overview.md).

# Overview

Hyperstream manages the indexing component of the Streambased product suite. Using Hyperstream, users can create, delete and utilise indexes to accelerate analytical queries that run on Streambased components.&#x20;

Hyperstream is optimised for queries that return result sets that are small combined to the larger data set and clusters together (queries filtered by timestamp range are a great example of this).

Hyperstream exposes the following API:

***

**Fetch table schemas:**

Request:

```properties
POST /api/schema
{
    "set": "HOT" # the dataset to fetch schemas from (HOT/COLD/MERGED)
}
```

Response:

```properties
{
    "customers" : [  # a table
        {   # a field            
            "col_name": "Name",
            "data_type": "string",
            "comment" : ""
        } 
    ]
}
```

***

**Run query:**

Request:

```properties
POST /api/query
{
    "set": "HOT", # the dataset to run the query one (HOT/COLD/MERGED)
    "sql": "SELECT * FROM customers",  # the query to run
    "index": true,  # whether to use indexes to increase performance
}
```

Response:

```properties
[  # a list of rows
    { 
        "Name" : "Judith Gottlieb", # key/value pair representing column value
        "Age" : 42
    }        
]

```

***

**Create Index:**

Request:

```properties
PUT /api/index
{
  "topic": "customers" # the topic to index
  "field": "Name"  ## the field to index
}
```

Response:

```properties
HTTP 200

```

***

**Get index lag:**

The index lag represents the amount of new messages written since the topic was last indexed. Lag will not effect the correctness of results but will decrease query performance.

Request:

```properties
POST /api/index
{
  "topic": "customers" # the topic to index
  "field": "Name"  ## the field to index
}
```

Response:

```properties
{
  "record_lag" : 42  # the number of message behind
}
```

***

**Enrich a query:**

Enriching a query adds extra clauses to take advantage of indexing information available and increase query performance.

Request:

```properties
POST /api/enrich
{
  "sql" : "SELECT * FROM customers WHERE Name = 'Judith Gottlieb'"
}
```

Response:

```properties
{
  "originalSql" : "SELECT * FROM customers WHERE Name = 'Judith Gottlieb'"
  "enrichedSql" : "SELECT * FROM (SELECT *  FROM customers WHERE (( kafka_partition = 0 AND kafka_offset >= 334000 AND kafka_offset < 335000)) OR  (( kafka_partition = 0 AND kafka_offset >= 999999 )))  WHERE Name = 'Judith Gottlieb'"
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.streambased.io/deploy-and-operate/streambased-platform/hyperstream/overview.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
