-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Aggs): Described all aggregation inputs
- Loading branch information
Showing
16 changed files
with
1,351 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* @flow */ | ||
|
||
import { InputTypeComposer } from 'graphql-compose'; | ||
import { getTypeName, getOrSetType, desc } from '../../../utils'; | ||
|
||
export function getAvgBucketITC(opts: mixed = {}): InputTypeComposer { | ||
const name = getTypeName('AggsAvgBucket', opts); | ||
const description = desc( | ||
` | ||
A sibling pipeline aggregation which calculates the (mean) average value | ||
of a specified metric in a sibling aggregation. The specified metric must | ||
be numeric and the sibling aggregation must be a multi-bucket aggregation. | ||
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-avg-bucket-aggregation.html) | ||
` | ||
); | ||
|
||
return getOrSetType(name, () => | ||
// $FlowFixMe | ||
InputTypeComposer.create({ | ||
name, | ||
description, | ||
fields: { | ||
buckets_path: 'String!', | ||
gap_policy: 'String', | ||
format: 'String', | ||
}, | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* @flow */ | ||
|
||
import { InputTypeComposer } from 'graphql-compose'; | ||
import { getTypeName, getOrSetType, desc } from '../../../utils'; | ||
|
||
export function getBucketScriptITC(opts: mixed = {}): InputTypeComposer { | ||
const name = getTypeName('AggsBucketScript', opts); | ||
const description = desc( | ||
` | ||
A parent pipeline aggregation which executes a script which can perform | ||
per bucket computations on specified metrics in the parent multi-bucket | ||
aggregation. The specified metric must be numeric and the script must | ||
return a numeric value. | ||
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-script-aggregation.html) | ||
` | ||
); | ||
|
||
return getOrSetType(name, () => | ||
// $FlowFixMe | ||
InputTypeComposer.create({ | ||
name, | ||
description, | ||
fields: { | ||
buckets_path: 'JSON!', | ||
script: 'String!', | ||
format: 'String', | ||
gap_policy: 'String', | ||
}, | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* @flow */ | ||
|
||
import { InputTypeComposer } from 'graphql-compose'; | ||
import { getTypeName, getOrSetType, desc } from '../../../utils'; | ||
|
||
export function getBucketSelectorITC(opts: mixed = {}): InputTypeComposer { | ||
const name = getTypeName('AggsBucketSelector', opts); | ||
const description = desc( | ||
` | ||
A parent pipeline aggregation which executes a script which determines | ||
whether the current bucket will be retained in the parent multi-bucket | ||
aggregation. The specified metric must be numeric and the script must | ||
return a boolean value. If the script language is expression then a numeric | ||
return value is permitted. In this case 0.0 will be evaluated as false | ||
and all other values will evaluate to true. | ||
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-selector-aggregation.html) | ||
` | ||
); | ||
|
||
return getOrSetType(name, () => | ||
// $FlowFixMe | ||
InputTypeComposer.create({ | ||
name, | ||
description, | ||
fields: { | ||
buckets_path: 'JSON!', | ||
script: 'String!', | ||
gap_policy: 'String', | ||
}, | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* @flow */ | ||
|
||
import { InputTypeComposer } from 'graphql-compose'; | ||
import { getTypeName, getOrSetType, desc } from '../../../utils'; | ||
|
||
export function getCumulativeSumITC(opts: mixed = {}): InputTypeComposer { | ||
const name = getTypeName('AggsCumulativeSum', opts); | ||
const description = desc( | ||
` | ||
A parent pipeline aggregation which calculates the cumulative sum of a | ||
specified metric in a parent histogram (or date_histogram) aggregation. | ||
The specified metric must be numeric and the enclosing histogram must | ||
have min_doc_count set to 0 (default for histogram aggregations). | ||
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-cumulative-sum-aggregation.html) | ||
` | ||
); | ||
|
||
return getOrSetType(name, () => | ||
// $FlowFixMe | ||
InputTypeComposer.create({ | ||
name, | ||
description, | ||
fields: { | ||
buckets_path: 'String!', | ||
format: 'String', | ||
}, | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* @flow */ | ||
|
||
import { InputTypeComposer } from 'graphql-compose'; | ||
import { getTypeName, getOrSetType, desc } from '../../../utils'; | ||
|
||
export function getDerivativeITC(opts: mixed = {}): InputTypeComposer { | ||
const name = getTypeName('AggsDerivative', opts); | ||
const description = desc( | ||
` | ||
A parent pipeline aggregation which calculates the derivative of a specified | ||
metric in a parent histogram (or date_histogram) aggregation. The specified | ||
metric must be numeric and the enclosing histogram must have min_doc_count | ||
set to 0 (default for histogram aggregations). | ||
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-derivative-aggregation.html) | ||
` | ||
); | ||
|
||
return getOrSetType(name, () => | ||
// $FlowFixMe | ||
InputTypeComposer.create({ | ||
name, | ||
description, | ||
fields: { | ||
buckets_path: 'String!', | ||
gap_policy: 'String', | ||
format: 'String', | ||
unit: 'String', | ||
}, | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* @flow */ | ||
|
||
import { InputTypeComposer } from 'graphql-compose'; | ||
import { getTypeName, getOrSetType, desc } from '../../../utils'; | ||
|
||
export function getExtendedStatsBucketITC(opts: mixed = {}): InputTypeComposer { | ||
const name = getTypeName('AggsExtendedStatsBucket', opts); | ||
const description = desc( | ||
` | ||
A sibling pipeline aggregation which calculates a variety of stats across | ||
all bucket of a specified metric in a sibling aggregation. The specified | ||
metric must be numeric and the sibling aggregation must be a multi-bucket | ||
aggregation. | ||
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-extended-stats-bucket-aggregation.html) | ||
` | ||
); | ||
|
||
return getOrSetType(name, () => | ||
// $FlowFixMe | ||
InputTypeComposer.create({ | ||
name, | ||
description, | ||
fields: { | ||
buckets_path: 'String!', | ||
gap_policy: 'String', | ||
format: 'String', | ||
sigma: 'Float', | ||
}, | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* @flow */ | ||
|
||
import { InputTypeComposer } from 'graphql-compose'; | ||
import { getTypeName, getOrSetType, desc } from '../../../utils'; | ||
|
||
export function getMaxBucketITC(opts: mixed = {}): InputTypeComposer { | ||
const name = getTypeName('AggsMaxBucket', opts); | ||
const description = desc( | ||
` | ||
A sibling pipeline aggregation which identifies the bucket(s) with | ||
the maximum value of a specified metric in a sibling aggregation and | ||
outputs both the value and the key(s) of the bucket(s). The specified | ||
metric must be numeric and the sibling aggregation must be a multi-bucket | ||
aggregation. | ||
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-max-bucket-aggregation.html) | ||
` | ||
); | ||
|
||
return getOrSetType(name, () => | ||
// $FlowFixMe | ||
InputTypeComposer.create({ | ||
name, | ||
description, | ||
fields: { | ||
buckets_path: 'String!', | ||
gap_policy: 'String', | ||
format: 'String', | ||
}, | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* @flow */ | ||
|
||
import { InputTypeComposer } from 'graphql-compose'; | ||
import { getTypeName, getOrSetType, desc } from '../../../utils'; | ||
|
||
export function getMinBucketITC(opts: mixed = {}): InputTypeComposer { | ||
const name = getTypeName('AggsMinBucket', opts); | ||
const description = desc( | ||
` | ||
A sibling pipeline aggregation which identifies the bucket(s) with | ||
the minimum value of a specified metric in a sibling aggregation and | ||
outputs both the value and the key(s) of the bucket(s). The specified | ||
metric must be numeric and the sibling aggregation must be a multi-bucket | ||
aggregation. | ||
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-min-bucket-aggregation.html) | ||
` | ||
); | ||
|
||
return getOrSetType(name, () => | ||
// $FlowFixMe | ||
InputTypeComposer.create({ | ||
name, | ||
description, | ||
fields: { | ||
buckets_path: 'String!', | ||
gap_policy: 'String', | ||
format: 'String', | ||
}, | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* @flow */ | ||
|
||
import { InputTypeComposer } from 'graphql-compose'; | ||
import { getTypeName, getOrSetType, desc } from '../../../utils'; | ||
|
||
export function getMovingAverageITC(opts: mixed = {}): InputTypeComposer { | ||
const name = getTypeName('AggsMovingAverage', opts); | ||
const description = desc( | ||
` | ||
Given an ordered series of data, the Moving Average aggregation will slide | ||
a window across the data and emit the average value of that window. | ||
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-movavg-aggregation.html) | ||
` | ||
); | ||
|
||
return getOrSetType(name, () => | ||
// $FlowFixMe | ||
InputTypeComposer.create({ | ||
name, | ||
description, | ||
fields: { | ||
buckets_path: 'String!', | ||
format: 'String', | ||
window: 'Int', | ||
gap_policy: 'String', | ||
model: 'String', | ||
settings: 'JSON', | ||
}, | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* @flow */ | ||
|
||
import { InputTypeComposer } from 'graphql-compose'; | ||
import { getTypeName, getOrSetType, desc } from '../../../utils'; | ||
|
||
export function getPercentilesBucketITC(opts: mixed = {}): InputTypeComposer { | ||
const name = getTypeName('AggsPercentilesBucket', opts); | ||
const description = desc( | ||
` | ||
A sibling pipeline aggregation which calculates percentiles across all | ||
bucket of a specified metric in a sibling aggregation. The specified metric | ||
must be numeric and the sibling aggregation must be a multi-bucket aggregation. | ||
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-percentiles-bucket-aggregation.html) | ||
` | ||
); | ||
|
||
return getOrSetType(name, () => | ||
// $FlowFixMe | ||
InputTypeComposer.create({ | ||
name, | ||
description, | ||
fields: { | ||
buckets_path: 'String!', | ||
gap_policy: 'String', | ||
format: 'String', | ||
percents: '[Float]', | ||
}, | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* @flow */ | ||
|
||
import { InputTypeComposer } from 'graphql-compose'; | ||
import { getTypeName, getOrSetType, desc } from '../../../utils'; | ||
|
||
export function getSerialDifferencingITC(opts: mixed = {}): InputTypeComposer { | ||
const name = getTypeName('AggsSerialDifferencing', opts); | ||
const description = desc( | ||
` | ||
Serial differencing is a technique where values in a time series are | ||
subtracted from itself at different time lags or periods. | ||
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-serialdiff-aggregation.html) | ||
` | ||
); | ||
|
||
return getOrSetType(name, () => | ||
// $FlowFixMe | ||
InputTypeComposer.create({ | ||
name, | ||
description, | ||
fields: { | ||
buckets_path: 'String!', | ||
lag: 'String', | ||
gap_policy: 'String', | ||
format: 'String', | ||
}, | ||
})); | ||
} |
Oops, something went wrong.