---
title: "query"
description: "Fields of a `query` variable."
---

> Documentation Index
> Fetch the complete documentation index at: https://slashobserve.com/llms.txt
> Use this file to discover all available pages before exploring further.

# query

## Example

```json
{
  "name": "pod",
  "type": "query",
  "datasource": "prom",
  "multi": true,
  "includeAll": true,
  "query": "label_values(http_requests_total{service=\"checkout\"}, pod)"
}
```

From [`spec/examples/checkout-service-health.json`](https://github.com/slashobserve/slashobserve/blob/main/spec/examples/checkout-service-health.json).

## Fields

| Field | Type | Description |
| --- | --- | --- |
| `name` (required) | `variableName` | Referenced in queries as $name, ${name} or ${name:format}. |
| `label` | `string` |   |
| `description` | `string` |   |
| `hide` | `"label"`, `"variable"` |   |
| `skipUrlSync` | `boolean` | The variable's value is not read from or written to the URL. |
| `type` (required) | `"query"` |   |
| `datasource` (required) | `datasourceRef` | A configured datasource uid, or ${name} naming a datasource variable declared in variables (before this variable, when used by one); queries then run on the datasource selected in that variable, and macros follow its datasourceType. |
| `query` (required) | `query` |   |
| `regex` | `string` |   |
| `sort` | `"alpha"`, `"alphaDesc"`, `"num"`, `"numDesc"`, `"alphaCaseInsensitive"`, `"alphaCaseInsensitiveDesc"`, `"natural"`, `"naturalDesc"` |   |
| `refresh` | `"load"`, `"timeRange"` or `"never"` |   |
| `staticOptions` | array of `object` | Options offered next to the query results. At most 50 items. |
| `staticOrder` | `"before"`, `"after"`, `"sorted"` | Where staticOptions go: before the query results (the default), after them, or merged and sorted with the variable's sort. |
| `allowCustomValue` | `boolean` |   |
| `multi` | `boolean` |   |
| `includeAll` | `boolean` |   |
| `allValue` | `string` |   |
| `default` | `selection` | Default selection: one value, several for a multi variable, or $__all. |

Generated from [`spec/schema/observespec.v0.json`](https://github.com/slashobserve/slashobserve/blob/bac0fe39/spec/schema/observespec.v0.json) at `bac0fe39`. [Report a problem](https://github.com/slashobserve/slashobserve/issues/new).
