---
title: "adhoc"
description: "Fields of a `adhoc` 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.

# adhoc

## Example

```json
{
  "name": "adhoc",
  "type": "adhoc",
  "datasource": "prom",
  "keys": [
    "service",
    "env",
    "pod"
  ],
  "listedValuesOnly": true,
  "baseFilters": [
    {
      "key": "env",
      "operator": "=",
      "value": "prod"
    }
  ],
  "default": [
    {
      "key": "service",
      "operator": "=",
      "value": "checkout",
      "keyLabel": "Service",
      "valueLabel": "Checkout"
    }
  ]
}
```

From [`spec/examples/evolved-features.json`](https://github.com/slashobserve/slashobserve/blob/main/spec/examples/evolved-features.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) | `"adhoc"` |   |
| `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. |
| `applyToAll` | `true` | ClickHouse only: also filter every query on this datasource that does not use this variable, on each table the query reads. |
| `default` | array of `adhocFilter` | At most 20 items. |
| `baseFilters` | array of `adhocFilter` | Filters always applied to this variable's queries, ANDed with the selected filters as a whole; never shown and never in the URL. At most 20 items. |
| `keys` | array of `string` | The keys the filter picker offers instead of asking the datasource. At most 100 items. |
| `listedValuesOnly` | `boolean` | A filter's key and value must be picked from the lists the picker shows; absent means any text may be typed. |

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).
