Functions
Trigonometric
Function | Specification | Example |
---|---|---|
acos | acos(number T) -> double | SELECT acos(0.5) FROM my-index LIMIT 1 |
asin | asin(number T) -> double | SELECT asin(0.5) FROM my-index LIMIT 1 |
atan | atan(number T) -> double | SELECT atan(0.5) FROM my-index LIMIT 1 |
atan2 | atan2(number T, number) -> double | SELECT atan2(1, 0.5) FROM my-index LIMIT 1 |
cos | cos(number T) -> double | SELECT cos(0.5) FROM my-index LIMIT 1 |
cosh | cosh(number T) -> double | SELECT cosh(0.5) FROM my-index LIMIT 1 |
cot | cot(number T) -> double | SELECT cot(0.5) FROM my-index LIMIT 1 |
degrees | degrees(number T) -> double | SELECT degrees(0.5) FROM my-index LIMIT 1 |
radians | radians(number T) -> double | SELECT radians(0.5) FROM my-index LIMIT 1 |
sin | sin(number T) -> double | SELECT sin(0.5) FROM my-index LIMIT 1 |
sinh | sinh(number T) -> double | SELECT sinh(0.5) FROM my-index LIMIT 1 |
tan | tan(number T) -> double | SELECT tan(0.5) FROM my-index LIMIT 1 |
String
Function | Specification | Example |
---|---|---|
ascii | ascii(string T) -> integer | SELECT ascii(name.keyword) FROM my-index LIMIT 1 |
concat | concat(str1, str2) -> string | SELECT concat(‘hello’, ‘world’) FROM my-index LIMIT 1 |
concat_ws | concat_ws(separator, string, string…) -> string | SELECT concat_ws(“-“, “Tutorial”, “is”, “fun!”) FROM my-index LIMIT 1 |
left | left(string T, integer) -> T | SELECT left(‘hello’, 2) FROM my-index LIMIT 1 |
length | length(string) -> integer | SELECT length(‘hello’) FROM my-index LIMIT 1 |
locate | locate(string, string, integer) -> integer or locate(string, string) -> INTEGER | SELECT locate(‘o’, ‘hello’) FROM my-index LIMIT 1 , SELECT locate(‘l’, ‘hello’, 3) FROM my-index LIMIT 1 |
replace | replace(string T, string, string) -> T | SELECT replace(‘hello’, ‘l’, ‘x’) FROM my-index LIMIT 1 |
right | right(string T, integer) -> T | SELECT right(‘hello’, 1) FROM my-index LIMIT 1 |
rtrim | rtrim(string T) -> T | SELECT rtrim(name.keyword) FROM my-index LIMIT 1 |
substring | substring(string T, integer, integer) -> T | SELECT substring(name.keyword, 2,5) FROM my-index LIMIT 1 |
trim | trim(string T) -> T | SELECT trim(‘ hello’) FROM my-index LIMIT 1 |
upper | upper(string T) -> T | SELECT upper(‘helloworld’) FROM my-index LIMIT 1 |
Advanced
Function | Specification | Example |
---|---|---|
if | if(boolean, es_type, es_type) -> es_type | SELECT if(false, 0, 1) FROM my-index LIMIT 1 , SELECT if(true, 0, 1) FROM my-index LIMIT 1 |
ifnull | ifnull(es_type, es_type) -> es_type | SELECT ifnull(‘hello’, 1) FROM my-index LIMIT 1 , SELECT ifnull(null, 1) FROM my-index LIMIT 1 |
isnull | isnull(es_type) -> integer | SELECT isnull(null) FROM my-index LIMIT 1 , SELECT isnull(1) FROM my-index LIMIT 1 |