原英文版地址: https://www.elastic.co/guide/en/elasticsearch/reference/7.7/sql-operators.html, 原文档版权归 www.elastic.co 所有
本地英文版地址: ../en/sql-operators.html
本地英文版地址: ../en/sql-operators.html
重要: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 当前版本文档。
Comparison Operatorsedit
Boolean operator for comparing against one or multiple expressions.
Equality (=)
edit
SELECT last_name l FROM "test_emp" WHERE emp_no = 10000 LIMIT 5;
Null safe Equality (<=>)
edit
SELECT 'elastic' <=> null AS "equals"; equals --------------- false
SELECT null <=> null AS "equals"; equals --------------- true
Inequality (<> or !=)
edit
SELECT last_name l FROM "test_emp" WHERE emp_no <> 10000 ORDER BY emp_no LIMIT 5;
Comparison (<, <=, >, >=)
edit
SELECT last_name l FROM "test_emp" WHERE emp_no < 10003 ORDER BY emp_no LIMIT 5;
BETWEEN
edit
SELECT last_name l FROM "test_emp" WHERE emp_no BETWEEN 9990 AND 10003 ORDER BY emp_no;
IS NULL/IS NOT NULL
edit
SELECT last_name l FROM "test_emp" WHERE emp_no IS NOT NULL AND gender IS NULL;
IN (<value1>, <value2>, ...)
edit
SELECT last_name l FROM "test_emp" WHERE emp_no IN (10000, 10001, 10002, 999) ORDER BY emp_no LIMIT 5;