I see that Elasticsearch supports Regex. But that is limited to Lucene's
Regex Engine which does not support anchoring i.e. the entire string will
always be anchored. This works as long as you have fixed regular
expressions to run, but in cases where the regex query is taken from the
user, this becomes very limiting.
Is there an alternative regex engine for Elasticsearch that at least
supports $ and ^ for anchoring? Quick Google and Github search did not get
me anything. If not, then is anybody doing something similar or have a work
around? One possible solution that I can think of is converting user's
entered regex to Lucene compatible regex. But that gets really complex to
do correctly with all the grouping and alternation in regex.
I don't want the entire Perl regex kind of support. Just the anchoring bit
is important. Has anybody tried to solve this problem before?
Lucene and Elastic Search both anchor regexp by default.
"Lucene’s patterns are always anchored. The pattern provided must match the
entire string. "
—
On Wednesday, December 18, 2013 7:19:48 AM UTC, Vaidik Kapoor wrote:
Hi Folks,
I see that Elasticsearch supports Regex. But that is limited to Lucene's
Regex Engine which does not support anchoring i.e. the entire string will
always be anchored. This works as long as you have fixed regular
expressions to run, but in cases where the regex query is taken from the
user, this becomes very limiting.
Is there an alternative regex engine for Elasticsearch that at least
supports $ and ^ for anchoring? Quick Google and Github search did not get
me anything. If not, then is anybody doing something similar or have a work
around? One possible solution that I can think of is converting user's
entered regex to Lucene compatible regex. But that gets really complex to
do correctly with all the grouping and alternation in regex.
I don't want the entire Perl regex kind of support. Just the anchoring bit
is important. Has anybody tried to solve this problem before?
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.