elastic-builder
Advanced tools
Comparing version 2.8.0 to 2.9.0
@@ -80,2 +80,52 @@ 'use strict'; | ||
} | ||
/** | ||
* Calendar-aware intervals are configured with the calendarInterval parameter. | ||
* The combined interval field for date histograms is deprecated from ES 7.2. | ||
* | ||
* @example | ||
* const agg = esb.dateHistogramAggregation('by_month', 'date').calendarInterval( | ||
* 'month' | ||
* ); | ||
* | ||
* @param {string} interval Interval to generate histogram over. | ||
* You can specify calendar intervals using the unit name, such as month, or as | ||
* a single unit quantity, such as 1M. For example, day and 1d are equivalent. | ||
* Multiple quantities, such as 2d, are not supported. | ||
* @returns {DateHistogramAggregation} returns `this` so that calls can be chained | ||
*/ | ||
}, { | ||
key: 'calendarInterval', | ||
value: function calendarInterval(interval) { | ||
this._aggsDef.calendar_interval = interval; | ||
return this; | ||
} | ||
/** | ||
* Fixed intervals are configured with the fixedInterval parameter. | ||
* The combined interval field for date histograms is deprecated from ES 7.2. | ||
* | ||
* @param {string} interval Interval to generate histogram over. | ||
* Intervals are a fixed number of SI units and never deviate, regardless | ||
* of where they fall on the calendar. However, it means fixed intervals | ||
* cannot express other units such as months, since the duration of a | ||
* month is not a fixed quantity. | ||
* | ||
* @example | ||
* const agg = esb.dateHistogramAggregation('by_minute', 'date').calendarInterval( | ||
* '60s' | ||
* ); | ||
* | ||
* The accepted units for fixed intervals are: | ||
* millseconds (ms), seconds (s), minutes (m), hours (h) and days (d). | ||
* @returns {DateHistogramAggregation} returns `this` so that calls can be chained | ||
*/ | ||
}, { | ||
key: 'fixedInterval', | ||
value: function fixedInterval(interval) { | ||
this._aggsDef.fixed_interval = interval; | ||
return this; | ||
} | ||
}]); | ||
@@ -82,0 +132,0 @@ return DateHistogramAggregation; |
{ | ||
"name": "elastic-builder", | ||
"version": "2.8.0", | ||
"version": "2.9.0", | ||
"description": "A JavaScript implementation of the elasticsearch Query DSL", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -15,3 +15,3 @@ # elastic-builder | ||
Relavant blog post: | ||
Relevant blog post: | ||
https://blog.logrocket.com/elasticsearch-query-body-builder-node-js/ | ||
@@ -18,0 +18,0 @@ |
@@ -54,4 +54,48 @@ 'use strict'; | ||
} | ||
/** | ||
* Calendar-aware intervals are configured with the calendarInterval parameter. | ||
* The combined interval field for date histograms is deprecated from ES 7.2. | ||
* | ||
* @example | ||
* const agg = esb.dateHistogramAggregation('by_month', 'date').calendarInterval( | ||
* 'month' | ||
* ); | ||
* | ||
* @param {string} interval Interval to generate histogram over. | ||
* You can specify calendar intervals using the unit name, such as month, or as | ||
* a single unit quantity, such as 1M. For example, day and 1d are equivalent. | ||
* Multiple quantities, such as 2d, are not supported. | ||
* @returns {DateHistogramAggregation} returns `this` so that calls can be chained | ||
*/ | ||
calendarInterval(interval) { | ||
this._aggsDef.calendar_interval = interval; | ||
return this; | ||
} | ||
/** | ||
* Fixed intervals are configured with the fixedInterval parameter. | ||
* The combined interval field for date histograms is deprecated from ES 7.2. | ||
* | ||
* @param {string} interval Interval to generate histogram over. | ||
* Intervals are a fixed number of SI units and never deviate, regardless | ||
* of where they fall on the calendar. However, it means fixed intervals | ||
* cannot express other units such as months, since the duration of a | ||
* month is not a fixed quantity. | ||
* | ||
* @example | ||
* const agg = esb.dateHistogramAggregation('by_minute', 'date').calendarInterval( | ||
* '60s' | ||
* ); | ||
* | ||
* The accepted units for fixed intervals are: | ||
* millseconds (ms), seconds (s), minutes (m), hours (h) and days (d). | ||
* @returns {DateHistogramAggregation} returns `this` so that calls can be chained | ||
*/ | ||
fixedInterval(interval) { | ||
this._aggsDef.fixed_interval = interval; | ||
return this; | ||
} | ||
} | ||
module.exports = DateHistogramAggregation; |
Sorry, the diff of this file is too big to display
1776633
42759