世界上并没有完美的程序,但是我们并不因此而沮丧,因为写程序就是一个不断追求完美的过程。
问:max有什么特点?
答:
问:max如何使用?
答:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140DELETE /max_test PUT /max_test { "mappings": { "properties": { "num_1": {"type": "integer"}, "num_2": {"type": "integer"}, "histo": {"type": "histogram"} } } } POST /max_test/_bulk {"index": {"_id": 1}} {"num_1": 10, "num_2": 50, "histo": {"values": [1, 2, 3, 4], "counts": [3, 4, 6, 5]}} {"index": {"_id": 2}} {"num_1": 20, "num_2": 40, "histo": {"values": [1, 2, 3, 6], "counts": [3, 4, 6, 5]}} {"index": {"_id": 3}} {"num_1": 5, "num_2": 60, "histo": {"values": [1, 2, 3, 8], "counts": [3, 4, 6, 5]}} {"index": {"_id": 4}} {"num_1": 6, "num_2": 80, "histo": {"values": [1, 2, 3, 5], "counts": [3, 4, 6, 5]}} GET /max_test/_search { "size": 0, "aggs": { "max_aggs": { "max": { "field": "num_1" } } } } # 结果 { "took" : 1, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 4, "relation" : "eq" }, "max_score" : null, "hits" : [ ] }, "aggregations" : { "max_aggs" : { "value" : 20.0 } } } GET /max_test/_search { "size": 0, "aggs": { "max_histo_aggs": { "max": { "field": "histo" } } } } # 结果 { "took" : 0, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 4, "relation" : "eq" }, "max_score" : null, "hits" : [ ] }, "aggregations" : { "max_histo_aggs" : { "value" : 8.0 } } } GET /max_test/_search { "size": 0, "aggs": { "max_num_script_aggs": { "max": { "field": "num_2", "script": { "lang": "painless", "source": "_value * params.param", "params": { "param": 10 } } } } } } # 结果 { "took" : 1, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 4, "relation" : "eq" }, "max_score" : null, "hits" : [ ] }, "aggregations" : { "max_num_script_aggs" : { "value" : 800.0 } } }
最后
以上就是传统花生最近收集整理的关于es - elasticsearch - aggs - metrics - max的全部内容,更多相关es内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复