Comparison operators
These binary operators compare scalars and instant vectors. By default they act as filters; with the bool modifier they return 0 or 1.
For the restrictions on comparisons in Elasticsearch, see PromQL limitations.
Compares elements for equality. By default, acts as a filter. With the bool modifier, returns 0 or 1.
Operands
lhs,rhs(instant_vectororscalar)- The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.
Returns
An instant_vector, or a scalar when both operands are scalars.
Example
requests_total == 256
Compares elements where the left operand is greater than the right. By default, acts as a filter. With the bool modifier, returns 0 or 1.
Operands
lhs,rhs(instant_vectororscalar)- The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.
Returns
An instant_vector, or a scalar when both operands are scalars.
Example
requests_total > 256
Compares elements where the left operand is greater than or equal to the right. By default, acts as a filter. With the bool modifier, returns 0 or 1.
Operands
lhs,rhs(instant_vectororscalar)- The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.
Returns
An instant_vector, or a scalar when both operands are scalars.
Example
requests_total >= 256
Compares elements where the left operand is less than the right. By default, acts as a filter. With the bool modifier, returns 0 or 1.
Operands
lhs,rhs(instant_vectororscalar)- The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.
Returns
An instant_vector, or a scalar when both operands are scalars.
Example
requests_total < 256
Compares elements where the left operand is less than or equal to the right. By default, acts as a filter. With the bool modifier, returns 0 or 1.
Operands
lhs,rhs(instant_vectororscalar)- The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.
Returns
An instant_vector, or a scalar when both operands are scalars.
Example
requests_total <= 256
Compares elements for inequality. By default, acts as a filter. With the bool modifier, returns 0 or 1.
Operands
lhs,rhs(instant_vectororscalar)- The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.
Returns
An instant_vector, or a scalar when both operands are scalars.
Example
requests_error != 0