From b5978ed8f9e2d46e3f1358152610a760f4359102 Mon Sep 17 00:00:00 2001
From: hagen1778 <roman@victoriametrics.com>
Date: Mon, 29 Jan 2024 14:00:14 +0100
Subject: [PATCH] docs: specify results of Instant and Range queries

Mention explicitly what are value and timestamp field in returned
results from Instant and Range queries.

Updates
https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5710
https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5708

Signed-off-by: hagen1778 <roman@victoriametrics.com>
---
 docs/keyConcepts.md | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/docs/keyConcepts.md b/docs/keyConcepts.md
index 2e787adb5d..2f02d8db2e 100644
--- a/docs/keyConcepts.md
+++ b/docs/keyConcepts.md
@@ -499,7 +499,7 @@ The API consists of two main handlers for serving [instant queries](#instant-que
 
 ### Instant query
 
-Instant query executes the query expression at the given timestamp:
+Instant query executes the `query` expression at the given `time`:
 
 ```
 GET | POST /api/v1/query?query=...&time=...&step=...
@@ -516,6 +516,10 @@ Params:
   For example, the request `/api/v1/query?query=up&step=1m` will look for the last written raw sample for the metric `up`
   in the interval between `now()` and `now()-1m`. If omitted, `step` is set to `5m` (5 minutes).
 
+The result of Instant query is a list of [time series](https://docs.victoriametrics.com/keyConcepts.html#time-series)
+matching the filter in `query` expression. Each series will have exactly one [raw sample](https://docs.victoriametrics.com/keyConcepts.html#raw-samples),
+where value will contain result of `query` expression, and timestamp - the requested `time`. 
+
 To understand how instant queries work, let's begin with a data sample:
 
 ```
@@ -557,7 +561,7 @@ curl "http://<victoria-metrics-addr>/api/v1/query?query=foo_bar&time=2022-05-10T
           "__name__": "foo_bar"
         },
         "value": [
-          1652169780,
+          1652169780, // 2022-05-10 10:03:00
           "3"
         ]
       }
@@ -586,7 +590,7 @@ the following scenarios:
 
 ### Range query
 
-Range query executes the query expression at the given time range with the given step:
+Range query executes the `query` expression at the given `time` range with the given `step`:
 
 ```
 GET | POST /api/v1/query_range?query=...&start=...&end=...&step=...
@@ -604,6 +608,11 @@ Params:
   The `query` is executed at `start`, `start+step`, `start+2*step`, ..., `end` timestamps.
   If the `step` isn't set, then it default to `5m` (5 minutes).
 
+The result of Range query is a list of [time series](https://docs.victoriametrics.com/keyConcepts.html#time-series)
+matching the filter in `query` expression. Each series will have arbitrary number of [raw samples](https://docs.victoriametrics.com/keyConcepts.html#raw-samples),
+where value containing result of `query` expression, and timestamp contains the moment in time at which the expression was executed.
+In other words, Range query is an [Instant query](#instant-query) executed `(end-start) / step` times.
+
 For example, to get the values of `foo_bar` during the time range from `2022-05-10 09:59:00` to `2022-05-10 10:17:00`,
 we need to issue a range query: