You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/commands/topk.add.md
+29-13Lines changed: 29 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,25 +33,41 @@ syntax_str: items [items ...]
33
33
title: TOPK.ADD
34
34
---
35
35
36
-
Adds an item to the data structure.
37
-
Multiple items can be added at once.
38
-
If an item enters the Top-K list, the item which is expelled is returned.
39
-
This allows dynamic heavy-hitter detection of items being entered or expelled from Top-K list.
36
+
Adds an item to a Top-k sketch.
37
+
Multiple items can be added at the same time.
38
+
If an item enters the Top-K sketch, the item that is expelled (if any) is returned.
39
+
This allows dynamic heavy-hitter detection of items being entered or expelled from Top-K sketch.
40
40
41
-
###Parameters
41
+
## Parameters
42
42
43
-
***key**: Name of sketch where item is added.
44
-
***item**: Item/s to be added.
43
+
***key**: the name of the sketch where items are added.
44
+
***item**: the items to be added.
45
45
46
-
### Return
47
-
48
-
[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - if an element was dropped from the TopK list, [Nil reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) otherwise..
49
-
50
-
#### Example
46
+
## Example
51
47
52
48
```
53
49
redis> TOPK.ADD topk foo bar 42
54
50
1) (nil)
55
51
2) baz
56
52
3) (nil)
57
-
```
53
+
```
54
+
55
+
## Return information
56
+
57
+
{{< multitabs id=“topk-add-return-info"
58
+
tab1="RESP2"
59
+
tab2="RESP3" >}}
60
+
61
+
One of the following:
62
+
63
+
*[Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) containing either dropped elements or [nil (null bulk string)]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}).
64
+
*[Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: incorrect number of arguments or non-existant key.
65
+
66
+
-tab-sep-
67
+
68
+
One of the following:
69
+
70
+
*[Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) containing either dropped elements or [null]({{< relref "/develop/reference/protocol-spec#nulls" >}}).
71
+
*[Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: incorrect number of arguments, non-existant key, or key of the incorrect type.
*[Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the count of each specified item. For non-existant items, `0` is returned.
66
+
*[Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: incorrect number of arguments, non-existant key, or key of the incorrect type.
67
+
68
+
-tab-sep-
69
+
70
+
One of the following:
71
+
72
+
*[Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the count of each specified item. For non-existant items, `0` is returned.
73
+
*[Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: incorrect number of arguments, non-existant key, or key of the incorrect type.
Increase the score of an item in the data structure by increment.
42
-
Multiple items' score can be increased at once.
43
-
If an item enters the Top-K list, the item which is expelled is returned.
41
+
Increase the score of an item in the data structure by `increment`.
42
+
Multiple items' scores can be increased at once.
43
+
If an item enters the Top-K list, the item that is expelled (if any) is returned.
44
44
45
45
### Parameters
46
46
47
-
***key**: Name of sketch where item is added.
48
-
***item**: Item/s to be added.
49
-
***increment**: increment to current item score. Increment must be greater or equal to 1. Increment is limited to 100,000 to avoid server freeze.
47
+
***key**: the name of the sketch.
48
+
***item**: the items to be incremented.
49
+
***increment**: the value by which items will be incremented. The `increment`must be greater or equal to 1 and less than or equal to 100,000 to avoid server freeze.
50
50
51
51
## Return
52
52
53
-
[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - if an element was dropped from the TopK list, [Nil reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) otherwise..
53
+
[Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - if an element was dropped from the TopK list, [Nil reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) otherwise..
54
54
55
-
@example
55
+
## Example
56
56
57
57
```
58
58
redis> TOPK.INCRBY topk foo 3 bar 2 42 30
59
59
1) (nil)
60
60
2) (nil)
61
61
3) foo
62
-
```
62
+
```
63
+
64
+
## Return information
65
+
66
+
{{< multitabs id=“topk-incrby-return-info"
67
+
tab1="RESP2"
68
+
tab2="RESP3" >}}
69
+
70
+
One of the following:
71
+
72
+
*[Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) containing either dropped elements or [nil (null bulk string)]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}).
73
+
*[Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: incorrect number of arguments, non-existant key, key of the incorrect type, or an incorrect increment (less than 0 or greater than 100,000).
74
+
75
+
-tab-sep-
76
+
77
+
One of the following:
78
+
79
+
*[Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) containing either dropped elements or [null]({{< relref "/develop/reference/protocol-spec#nulls" >}}).
80
+
*[Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: incorrect number of arguments, non-existant key, key of the incorrect type, or an incorrect increment (less than 0 or greater than 100,000).
Copy file name to clipboardExpand all lines: content/commands/topk.info.md
+23-7Lines changed: 23 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,15 +29,11 @@ syntax_fmt: TOPK.INFO key
29
29
syntax_str: ''
30
30
title: TOPK.INFO
31
31
---
32
-
Returns number of required items (k), width, depth and decay values.
32
+
Returns number of required items (k), width, depth, and decay values of a given sketch.
33
33
34
-
###Parameters
34
+
## Parameters
35
35
36
-
***key**: Name of sketch.
37
-
38
-
## Return
39
-
40
-
[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) with information of the filter.
36
+
***key**: the name of the sketch.
41
37
42
38
## Examples
43
39
@@ -52,3 +48,23 @@ TOPK.INFO topk
52
48
7) decay
53
49
8) "0.92500000000000004"
54
50
```
51
+
52
+
## Return information
53
+
54
+
{{< multitabs id=“topk-info-return-info"
55
+
tab1="RESP2"
56
+
tab2="RESP3" >}}
57
+
58
+
One of the following:
59
+
60
+
*[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [simple string]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) and [integer]({{< relref "/develop/reference/protocol-spec#integers" >}}) pairs. For decay, a [simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) is used to represent the floating point value.
61
+
*[Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: incorrect number of arguments, non-existant key, or key of the incorrect type.
62
+
63
+
-tab-sep-
64
+
65
+
One of the following:
66
+
67
+
*[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [simple string]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) and [integer]({{< relref "/develop/reference/protocol-spec#integers" >}}) pairs. For decay, a [double reply]({{< relref "/develop/reference/protocol-spec#doubles" >}}) is used to represent the floating point value.
68
+
*[Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: incorrect number of arguments, non-existant key, or key of the incorrect type.
Copy file name to clipboardExpand all lines: content/commands/topk.list.md
+31-16Lines changed: 31 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,34 +21,24 @@ categories:
21
21
- kubernetes
22
22
- clients
23
23
complexity: O(k*log(k)) where k is the value of top-k
24
-
description: Return full list of items in Top K list
24
+
description: Return the full list of items in the Top-K sketch
25
25
group: topk
26
26
hidden: false
27
27
linkTitle: TOPK.LIST
28
28
module: Bloom
29
29
since: 2.0.0
30
30
stack_path: docs/data-types/probabilistic
31
-
summary: Return full list of items in Top K list
31
+
summary: Return the full list of items in the Top-K sketch
32
32
syntax_fmt: TOPK.LIST key [WITHCOUNT]
33
33
syntax_str: '[WITHCOUNT]'
34
34
title: TOPK.LIST
35
35
---
36
-
Return full list of items in Top K list.
36
+
Return the full list of items in Top-K sketch.
37
37
38
-
###Parameters
38
+
## Parameters
39
39
40
-
***key**: Name of sketch where item is counted.
41
-
***WITHCOUNT**: Count of each element is returned.
42
-
43
-
## Return
44
-
45
-
k (or less) items in Top K list.
46
-
47
-
The list is sorted by decreased count estimation.
48
-
49
-
[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - the names of items in the TopK list.
50
-
If `WITHCOUNT` is requested, [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) and
51
-
[Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) pairs of the names of items in the TopK list and their count.
40
+
***key**: the name of the sketch.
41
+
***WITHCOUNT**: the count of each element is also returned.
52
42
53
43
## Examples
54
44
@@ -68,3 +58,28 @@ TOPK.LIST topk WITHCOUNT
68
58
5) bar
69
59
6) (integer) 2
70
60
```
61
+
62
+
63
+
## Return information
64
+
65
+
k (or less) items in the given Top-k sketch. The list is sorted by decreased count estimation.
66
+
67
+
{{< multitabs id=“topk-info-return-info"
68
+
tab1="RESP2"
69
+
tab2="RESP3" >}}
70
+
71
+
One of the following:
72
+
73
+
*[Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) representing the names of items in the given sketch. If `WITHCOUNT` is requested, an [array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) and
74
+
[integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) pairs, representing the names of the items in the sketch together with their counts.
75
+
*[Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, non-existant key, or key of the incorrect type.
76
+
77
+
-tab-sep-
78
+
79
+
One of the following:
80
+
81
+
*[Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) representing the names of items in the given sketch. If `WITHCOUNT` is requested, an [array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) and
82
+
[integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) pairs, representing the names of the items in the sketch together with their counts.
83
+
*[Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: invalid arguments, non-existant key, or key of the incorrect type.
Checks whether one or more items are one of the Top-K items.
37
36
38
-
###Parameters
37
+
## Parameters
39
38
40
-
***key**: Name of sketch where item is queried.
41
-
***item**: Item/s to be queried.
39
+
***key**: the name of the sketch.
40
+
***item**: the items to be queried.
42
41
43
-
## Return
44
-
45
-
[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) - "1" if item is in Top-K, otherwise "0".
46
-
47
-
## Examples
42
+
## Example
48
43
49
44
```
50
45
redis> TOPK.QUERY topk 42 nonexist
51
46
1) (integer) 1
52
47
2) (integer) 0
53
-
```
48
+
```
49
+
50
+
## Return information
51
+
52
+
{{< multitabs id=“topk-query-return-info"
53
+
tab1="RESP2"
54
+
tab2="RESP3" >}}
55
+
56
+
One of the following:
57
+
58
+
*[Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}): `1` if an item is in the Top-K or `0` otherwise.
59
+
*[Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: non-existant key or key of the incorrect type.
60
+
61
+
-tab-sep-
62
+
63
+
*[Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [boolean replies]({{< relref "/develop/reference/protocol-spec#booleans" >}}): `true` if an item is in the Top-K or `false` otherwise.
64
+
*[Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: non-existant key or key of the incorrect type.
0 commit comments