From 6d6e47f1965697a830d94836058b7b9ef4d97036 Mon Sep 17 00:00:00 2001 From: Joel Bernstein Date: Thu, 1 Jun 2017 16:26:57 -0400 Subject: [PATCH] SOLR-10566: Add documentation --- solr/solr-ref-guide/src/stream-sources.adoc | 31 ++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/solr/solr-ref-guide/src/stream-sources.adoc b/solr/solr-ref-guide/src/stream-sources.adoc index e7356ae3ee9..986a5daf14b 100644 --- a/solr/solr-ref-guide/src/stream-sources.adoc +++ b/solr/solr-ref-guide/src/stream-sources.adoc @@ -390,7 +390,36 @@ stats(collection1, == timeseries -//TODO +The `timeseries` function builds a time series aggregation. Under the covers the `timeseries` function uses the +JSON Facet API as its high performance aggregation engine. + +=== timeseries Parameters + +* `collection`: (Mandatory) Collection the stats will be aggregated from. +* `q`: (Mandatory) The query to build the aggregations from. +* `field`: (Mandatory) The date field for the time series. +* `start`: (Mandatory) The start of the time series expressed in Solr date or date math syntax. +* `end`: (Mandatory) The end of the time series expressed in Solr date or date math syntax. +* `gap`: (Mandatory) The time gap between time series aggregation points expressed in Solr date math syntax. +* `metrics`: (Mandatory) The metrics to include in the result tuple. Current supported metrics are `sum(col)`, `avg(col)`, `min(col)`, `max(col)` and `count(*)` + +=== timeseries Syntax + +[source,text] +---- +timeseries(collection1, + q=*:*, + field="rec_dt" + start="NOW-30DAYS", + end="NOW", + gap="+1DAY", + sum(a_i), + max(a_i), + max(a_f), + avg(a_i), + avg(a_f), + count(*)) +---- == train