2023-02-02 16:01:02 +08:00
---
keywords:
- grafana
- schema
title: ElasticsearchDataQuery kind
---
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice.
2023-02-02 23:12:31 +08:00
## ElasticsearchDataQuery
2023-02-02 16:01:02 +08:00
2023-02-07 18:02:05 +08:00
#### Maturity: [experimental](../../../maturity/#experimental)
2023-02-02 23:12:31 +08:00
#### Version: 0.0
2023-02-02 16:01:02 +08:00
2023-05-24 16:47:25 +08:00
| Property | Type | Required | Default | Description |
|--------------|-------------------------------------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `refId` | string | **Yes** | | A unique identifier for the query within the list of targets.< br /> In server side expressions, the refId is used as a variable name to identify results.< br /> By default, the UI will assign A->Z; however setting meaningful names may be useful. |
| `alias` | string | No | | Alias pattern |
| `bucketAggs` | [BucketAggregation ](#bucketaggregation )[] | No | | List of bucket aggregations |
| `datasource` | | No | | For mixed data sources the selected datasource is on the query level.< br /> For non mixed scenarios this is undefined.< br /> TODO find a better way to do this ^ that's friendly to schema< br /> TODO this shouldn't be unknown but DataSourceRef | null |
| `hide` | boolean | No | | true if query is disabled (ie should not be returned to the dashboard)< br /> Note this does not always imply that the query should not be executed since< br /> the results from a hidden query may be used as the input to other queries (SSE etc) |
| `metrics` | [MetricAggregation ](#metricaggregation )[] | No | | List of metric aggregations |
| `queryType` | string | No | | Specify the query flavor< br /> TODO make this required and give it a default |
| `query` | string | No | | Lucene query |
| `timeField` | string | No | | Name of time field |
2023-02-02 23:12:31 +08:00
### BucketAggregation
2023-02-02 16:01:02 +08:00
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|---------|-------------|
| `object` | Possible types are: [DateHistogram ](#datehistogram ), [Histogram ](#histogram ), [Terms ](#terms ), [Filters ](#filters ), [GeoHashGrid ](#geohashgrid ), [Nested ](#nested ). | | |
2023-03-04 00:48:25 +08:00
### DateHistogram
It extends [BucketAggregationWithField ](#bucketaggregationwithfield ).
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|------------|--------|----------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* < br /> Possible values are: `terms` , `filters` , `geohash_grid` , `date_histogram` , `histogram` , `nested` . |
| `field` | string | No | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `id` | string | No | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `settings` | | No | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
2023-03-04 00:48:25 +08:00
### BucketAggregationWithField
It extends [BaseBucketAggregation ](#basebucketaggregation ).
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|------------|--------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id` | string | **Yes** | | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* |
| `type` | string | **Yes** | | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* < br /> Possible values are: `terms` , `filters` , `geohash_grid` , `date_histogram` , `histogram` , `nested` . |
| `field` | string | No | | |
| `settings` | | No | | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* |
2023-03-04 00:48:25 +08:00
### BaseBucketAggregation
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|------------|--------|----------|---------|---------------------------------------------------------------------------------------------------|
| `id` | string | **Yes** | | |
| `type` | string | **Yes** | | Possible values are: `terms` , `filters` , `geohash_grid` , `date_histogram` , `histogram` , `nested` . |
| `settings` | | No | | |
2023-02-02 16:01:02 +08:00
2023-03-04 00:48:25 +08:00
### Filters
It extends [BaseBucketAggregation ](#basebucketaggregation ).
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|------------|--------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id` | string | **Yes** | | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* |
| `type` | string | **Yes** | | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* < br /> Possible values are: `terms` , `filters` , `geohash_grid` , `date_histogram` , `histogram` , `nested` . |
| `settings` | | No | | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* |
2023-03-04 00:48:25 +08:00
### GeoHashGrid
It extends [BucketAggregationWithField ](#bucketaggregationwithfield ).
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|------------|--------|----------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* < br /> Possible values are: `terms` , `filters` , `geohash_grid` , `date_histogram` , `histogram` , `nested` . |
| `field` | string | No | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `id` | string | No | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `settings` | | No | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
2023-03-04 00:48:25 +08:00
### Histogram
It extends [BucketAggregationWithField ](#bucketaggregationwithfield ).
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|------------|--------|----------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* < br /> Possible values are: `terms` , `filters` , `geohash_grid` , `date_histogram` , `histogram` , `nested` . |
| `field` | string | No | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `id` | string | No | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `settings` | | No | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
2023-03-04 00:48:25 +08:00
### Nested
It extends [BucketAggregationWithField ](#bucketaggregationwithfield ).
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|------------|--------|----------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* < br /> Possible values are: `terms` , `filters` , `geohash_grid` , `date_histogram` , `histogram` , `nested` . |
| `field` | string | No | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `id` | string | No | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `settings` | | No | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
2023-03-04 00:48:25 +08:00
### Terms
It extends [BucketAggregationWithField ](#bucketaggregationwithfield ).
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|------------|--------|----------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* < br /> Possible values are: `terms` , `filters` , `geohash_grid` , `date_histogram` , `histogram` , `nested` . |
| `field` | string | No | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `id` | string | No | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `settings` | | No | | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
2023-03-04 00:48:25 +08:00
2023-02-02 23:12:31 +08:00
### MetricAggregation
2023-02-02 16:01:02 +08:00
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|----------|------------------------------------------------------------------------------------------------------|----------|---------|-------------|
| `object` | Possible types are: [Count ](#count ), [PipelineMetricAggregation ](#pipelinemetricaggregation ), [](#). | | |
2023-03-04 00:48:25 +08:00
### Count
It extends [BaseMetricAggregation ](#basemetricaggregation ).
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|----------|---------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id` | string | **Yes** | | *(Inherited from [BaseMetricAggregation](#basemetricaggregation))* |
| `type` | string | **Yes** | | *(Inherited from [BaseMetricAggregation](#basemetricaggregation))* < br /> Possible values are: `count` , `avg` , `sum` , `min` , `max` , `extended_stats` , `percentiles` , `cardinality` , `raw_document` , `raw_data` , `logs` , `rate` , `top_metrics` , `moving_avg` , `moving_fn` , `derivative` , `serial_diff` , `cumulative_sum` , `bucket_script` . |
| `hide` | boolean | No | | *(Inherited from [BaseMetricAggregation](#basemetricaggregation))* |
2023-03-04 00:48:25 +08:00
### BaseMetricAggregation
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|----------|---------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id` | string | **Yes** | | |
| `type` | string | **Yes** | | Possible values are: `count` , `avg` , `sum` , `min` , `max` , `extended_stats` , `percentiles` , `cardinality` , `raw_document` , `raw_data` , `logs` , `rate` , `top_metrics` , `moving_avg` , `moving_fn` , `derivative` , `serial_diff` , `cumulative_sum` , `bucket_script` . |
| `hide` | boolean | No | | |
2023-03-04 00:48:25 +08:00
### PipelineMetricAggregation
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------|----------|---------|-------------|
| `object` | Possible types are: [MovingAverage ](#movingaverage ), [Derivative ](#derivative ), [CumulativeSum ](#cumulativesum ), [BucketScript ](#bucketscript ). | | |
2023-03-04 00:48:25 +08:00
### BucketScript
It extends [PipelineMetricAggregationWithMultipleBucketPaths ](#pipelinemetricaggregationwithmultiplebucketpaths ).
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|---------------------|-----------------------------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | | *(Inherited from [PipelineMetricAggregationWithMultipleBucketPaths](#pipelinemetricaggregationwithmultiplebucketpaths))* < br /> Possible values are: `count` , `avg` , `sum` , `min` , `max` , `extended_stats` , `percentiles` , `cardinality` , `raw_document` , `raw_data` , `logs` , `rate` , `top_metrics` , `moving_avg` , `moving_fn` , `derivative` , `serial_diff` , `cumulative_sum` , `bucket_script` . |
| `hide` | boolean | No | | *(Inherited from [PipelineMetricAggregationWithMultipleBucketPaths](#pipelinemetricaggregationwithmultiplebucketpaths))* |
| `id` | string | No | | *(Inherited from [PipelineMetricAggregationWithMultipleBucketPaths](#pipelinemetricaggregationwithmultiplebucketpaths))* |
| `pipelineVariables` | [PipelineVariable ](#pipelinevariable )[] | No | | *(Inherited from [PipelineMetricAggregationWithMultipleBucketPaths](#pipelinemetricaggregationwithmultiplebucketpaths))* |
| `settings` | [object ](#settings ) | No | | |
2023-03-04 00:48:25 +08:00
### PipelineMetricAggregationWithMultipleBucketPaths
It extends [BaseMetricAggregation ](#basemetricaggregation ).
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|---------------------|-----------------------------------------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id` | string | **Yes** | | *(Inherited from [BaseMetricAggregation](#basemetricaggregation))* |
| `type` | string | **Yes** | | *(Inherited from [BaseMetricAggregation](#basemetricaggregation))* < br /> Possible values are: `count` , `avg` , `sum` , `min` , `max` , `extended_stats` , `percentiles` , `cardinality` , `raw_document` , `raw_data` , `logs` , `rate` , `top_metrics` , `moving_avg` , `moving_fn` , `derivative` , `serial_diff` , `cumulative_sum` , `bucket_script` . |
| `hide` | boolean | No | | *(Inherited from [BaseMetricAggregation](#basemetricaggregation))* |
| `pipelineVariables` | [PipelineVariable ](#pipelinevariable )[] | No | | |
2023-03-04 00:48:25 +08:00
### PipelineVariable
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|---------------|--------|----------|---------|-------------|
| `name` | string | **Yes** | | |
| `pipelineAgg` | string | **Yes** | | |
2023-03-04 00:48:25 +08:00
### Settings
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|----------|------|----------|---------|-------------|
| `script` | | No | | |
2023-03-04 00:48:25 +08:00
### CumulativeSum
It extends [BasePipelineMetricAggregation ](#basepipelinemetricaggregation ).
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|---------------|---------------------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* < br /> Possible values are: `count` , `avg` , `sum` , `min` , `max` , `extended_stats` , `percentiles` , `cardinality` , `raw_document` , `raw_data` , `logs` , `rate` , `top_metrics` , `moving_avg` , `moving_fn` , `derivative` , `serial_diff` , `cumulative_sum` , `bucket_script` . |
| `field` | string | No | | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* |
| `hide` | boolean | No | | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* |
| `id` | string | No | | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* |
| `pipelineAgg` | string | No | | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* |
| `settings` | [object ](#settings ) | No | | |
2023-03-04 00:48:25 +08:00
### BasePipelineMetricAggregation
It extends [MetricAggregationWithField ](#metricaggregationwithfield ).
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|---------------|---------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | | *(Inherited from [MetricAggregationWithField](#metricaggregationwithfield))* < br /> Possible values are: `count` , `avg` , `sum` , `min` , `max` , `extended_stats` , `percentiles` , `cardinality` , `raw_document` , `raw_data` , `logs` , `rate` , `top_metrics` , `moving_avg` , `moving_fn` , `derivative` , `serial_diff` , `cumulative_sum` , `bucket_script` . |
| `field` | string | No | | *(Inherited from [MetricAggregationWithField](#metricaggregationwithfield))* |
| `hide` | boolean | No | | *(Inherited from [MetricAggregationWithField](#metricaggregationwithfield))* |
| `id` | string | No | | *(Inherited from [MetricAggregationWithField](#metricaggregationwithfield))* |
| `pipelineAgg` | string | No | | |
2023-03-04 00:48:25 +08:00
### MetricAggregationWithField
It extends [BaseMetricAggregation ](#basemetricaggregation ).
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|----------|---------|----------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id` | string | **Yes** | | *(Inherited from [BaseMetricAggregation](#basemetricaggregation))* |
| `type` | string | **Yes** | | *(Inherited from [BaseMetricAggregation](#basemetricaggregation))* < br /> Possible values are: `count` , `avg` , `sum` , `min` , `max` , `extended_stats` , `percentiles` , `cardinality` , `raw_document` , `raw_data` , `logs` , `rate` , `top_metrics` , `moving_avg` , `moving_fn` , `derivative` , `serial_diff` , `cumulative_sum` , `bucket_script` . |
| `field` | string | No | | |
| `hide` | boolean | No | | *(Inherited from [BaseMetricAggregation](#basemetricaggregation))* |
2023-03-04 00:48:25 +08:00
### Settings
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|----------|--------|----------|---------|-------------|
| `format` | string | No | | |
2023-03-04 00:48:25 +08:00
### Derivative
It extends [BasePipelineMetricAggregation ](#basepipelinemetricaggregation ).
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|---------------|---------------------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* < br /> Possible values are: `count` , `avg` , `sum` , `min` , `max` , `extended_stats` , `percentiles` , `cardinality` , `raw_document` , `raw_data` , `logs` , `rate` , `top_metrics` , `moving_avg` , `moving_fn` , `derivative` , `serial_diff` , `cumulative_sum` , `bucket_script` . |
| `field` | string | No | | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* |
| `hide` | boolean | No | | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* |
| `id` | string | No | | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* |
| `pipelineAgg` | string | No | | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* |
| `settings` | [object ](#settings ) | No | | |
2023-03-04 00:48:25 +08:00
### Settings
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|----------|--------|----------|---------|-------------|
| `unit` | string | No | | |
2023-03-04 00:48:25 +08:00
### MovingAverage
#MovingAverage's settings are overridden in types.ts
It extends [BasePipelineMetricAggregation ](#basepipelinemetricaggregation ).
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|---------------|---------------------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* < br /> Possible values are: `count` , `avg` , `sum` , `min` , `max` , `extended_stats` , `percentiles` , `cardinality` , `raw_document` , `raw_data` , `logs` , `rate` , `top_metrics` , `moving_avg` , `moving_fn` , `derivative` , `serial_diff` , `cumulative_sum` , `bucket_script` . |
| `field` | string | No | | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* |
| `hide` | boolean | No | | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* |
| `id` | string | No | | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* |
| `pipelineAgg` | string | No | | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* |
| `settings` | [object ](#settings ) | No | | |
2023-03-04 00:48:25 +08:00
2023-03-08 19:12:44 +08:00
### Settings
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|----------|------|----------|---------|-------------|
2023-03-08 19:12:44 +08:00
2023-03-04 00:48:25 +08:00
### Meta
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|----------|------|----------|---------|-------------|
2023-02-02 16:01:02 +08:00
2023-03-04 00:48:25 +08:00
### Settings
2023-03-23 01:42:28 +08:00
| Property | Type | Required | Default | Description |
|-----------|----------|----------|---------|-------------|
| `metrics` | string[] | No | | |
| `orderBy` | string | No | | |
| `order` | string | No | | |
2023-03-04 00:48:25 +08:00
2023-02-02 16:01:02 +08:00