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.
In Elasticsearch, a comparison is evaluated only at the top level of an expression and only with a scalar literal on the right-hand side. Comparisons between two instant vectors, and nested comparisons, return a client error (4xx). 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