本文介绍Elasticsearch Serverless对PromQL操作符和函数的支持情况。

操作符

二元运算符

运算符类型是否支持说明
addOpbinaryOperator加、减
andUnlessOpbinaryOperator集合运算(and、or、unless)
compareOpbinaryOperator比较(==,>=, >, <=, <, !=)
multOpbinaryOperator乘、除、取模
orOpbinaryOperator集合运算(or)
powOpbinaryOperator幂乘

聚合操作符

操作符是否支持说明
avg(calculate the average over dimensions)平均值
bottomk(smallest k elements by sample value)样本值最小的k个元素
count(count number of elements in the vector)计数
count_values(count number of elements with the same value)对值进行计数
group(all values in the resulting vector are 1)结果向量中的所有值均为1
max(select maximum over dimensions)最大值
min(select minimum over dimensions)最小值
quantile(calculate φ-quantile (0 ≤ φ ≤ 1) over dimensions)分布统计
sum(calculate sum over dimensions)求和
stddev(calculate population standard deviation over dimensions)标准差
stdvar(calculate population standard variance over dimensions)标准差异
topk(largest k elements by sample value)样本值中最大的k个元素

其他操作符

表达式类型是否支持说明
aggregationvector聚合运算
functionvector函数
groupinggroupgroup聚合,包括on、ignoring、group_left、group_right
instantSelectorvector瞬时选择器
labelMatchervector标签匹配
literalvector常量
matrixSelectorvector向量选择器
offsetvector偏移量
unaryOpbinaryOperator正、负

函数

Function是否支持
abs(v instant-vector)
absent(v instant-vector)
absent_over_time(v range-vector)
ceil(v instant-vector)
changes(v range-vector)
clamp(v instant-vector, min scalar, max scalar)
clamp_max(v instant-vector, max scalar)
clamp_min(v instant-vector, min scalar)
day_of_month(v=vector(time()) instant-vector)
day_of_week(v=vector(time()) instant-vector)
days_in_month(v=vector(time()) instant-vector)
delta(v range-vector)
deriv(v range-vector)
exp(v instant-vector)
floor(v instant-vector)
histogram_quantile(φ scalar, b instant-vector)
holt_winters(v range-vector, sf scalar, tf scalar)
hour(v=vector(time()) instant-vector)
idelta(v range-vector)
increase(v range-vector)
irate(v range-vector)
label_join(v instant-vector, dst_label string, separator string, src_label_1 string, src_label_2 string, ...)
label_replace(v instant-vector, dst_label string, replacement string, src_label string, regex string)
ln(v instant-vector)
log2(v instant-vector)
log10(v instant-vector)
minute(v=vector(time()) instant-vector)
month(v=vector(time()) instant-vector)
predict_linear(v range-vector, t scalar)
rate(v range-vector)
resets(v range-vector)
round(v instant-vector, to_nearest=1 scalar)
scalar(v instant-vector)
sgn(v instant-vector)
sort(v instant-vector)
sort_desc()
sqrt(v instant-vector)
time()
timestamp(v instant-vector)
vector(s scalar)
year(v=vector(time()) instant-vector)

<aggregation>_over_time()

Function是否支持
avg_over_time(range-vector)
count_over_time(range-vector)
last_over_time(range-vector)
max_over_time(range-vector)
min_over_time(range-vector)
present_over_time(range-vector)
quantile_over_time(scalar, range-vector)
stddev_over_time(range-vector)
stdvar_over_time(range-vector)
sum_over_time(range-vector)

Trigonometric Functions

Function是否支持
acos(v instant-vector)
acosh(v instant-vector)
asin(v instant-vector)
asinh(v instant-vector)
atan(v instant-vector)
atanh(v instant-vector)
cos(v instant-vector)
cosh(v instant-vector)
deg(v instant-vector)
pi()
rad(v instant-vector)
sin(v instant-vector)
sinh(v instant-vector)
tan(v instant-vector)
tanh(v instant-vector)