I am trying for a case-insensitive RLIKE operation in elasticsearch SQL.
E.g.
WHERE column1 RLIKE '.*Gop.*'
I tried using LCASE, UCASE in WHERE clause on the field, but is giving below error.
"root_cause": [
{
"type": "sql_illegal_argument_exception",
"reason": "Scalar function [UCASE(column1)] not allowed (yet) as argument for RLIKE"
}
]
LIKE and RLIKE expressions are translated to wildcard and regexp queries respectively. If we allowed the usage of scalar functions like LCASE/UCASE, then the query should be instead get translated into a script query which, in general, would have much more poor performance compared to the already expensive regexp/wildcard queries.
A workaround to achieve your goal is to create case insensitive pattern manually: WHERE column1 RLIKE '.*[g|G][o|O][p|P].*'
You can find more info regarding the regexp pattern here.
I am planning to use the lowercase normaliser.
Is there a way to define the normaliser in template and automatically apply to all string field of the index?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.