# Why es has not something like RegexQueryBuilder?

**URL:** <https://discuss.elastic.co/t/why-es-has-not-something-like-regexquerybuilder/4511>\
**Category:** Elasticsearch\
**Created:** [June 1, 2011, 5:04am UTC](https://discuss.elastic.co/t/why-es-has-not-something-like-regexquerybuilder/4511 "2011-06-01T05:04:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Weiwei\_Wang](https://avatars.discourse-cdn.com/v4/letter/w/b19c9b/32.png) [@Weiwei\_Wang](https://discuss.elastic.co/u/Weiwei_Wang)\
**Post date:** [June 1, 2011, 5:04am UTC](https://discuss.elastic.co/t/why-es-has-not-something-like-regexquerybuilder/4511/1 "2011-06-01T05:04:13Z")

</div>

I need to do some regex search but can not find a QueryBuilder like  
RegexQueryBuilder.

how should i do regex search under ES?

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [June 1, 2011, 9:21am UTC](https://discuss.elastic.co/t/why-es-has-not-something-like-regexquerybuilder/4511/2 "2011-06-01T09:21:49Z")

</div>

On Tue, 2011-05-31 at 22:04 -0700, Weiwei Wang wrote:

> I need to do some regex search but can not find a QueryBuilder like  
> RegexQueryBuilder.
> 
> how should i do regex search under ES?

Currently the RegexQueryBuilder isn't in ES. You can open an issue to  
have it included if you like. Not sure why Shay hasn't included it - he  
may have a reason

c

---

<div class="post-metadata">

**Author:** ![Weiwei\_Wang](https://avatars.discourse-cdn.com/v4/letter/w/b19c9b/32.png) [@Weiwei\_Wang](https://discuss.elastic.co/u/Weiwei_Wang)\
**Post date:** [June 1, 2011, 12:41pm UTC](https://discuss.elastic.co/t/why-es-has-not-something-like-regexquerybuilder/4511/3 "2011-06-01T12:41:38Z")

</div>

It's better to provide a LuceneQueryWrapperBuilder to wrap a lucene  
query, in this way we can employ all the query functions provided by  
Lucene/

On Jun 1, 5:21 pm, Clinton Gormley [clin...@iannounce.co.uk](mailto:clin...@iannounce.co.uk) wrote:

> On Tue, 2011-05-31 at 22:04 -0700, Weiwei Wang wrote:
> 
> > I need to do some regex search but can not find a QueryBuilder like  
> > RegexQueryBuilder.
> 
> > how should i do regex search under ES?
> 
> Currently the RegexQueryBuilder isn't in ES. You can open an issue to  
> have it included if you like. Not sure why Shay hasn't included it - he  
> may have a reason
> 
> c

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [June 1, 2011, 12:43pm UTC](https://discuss.elastic.co/t/why-es-has-not-something-like-regexquerybuilder/4511/4 "2011-06-01T12:43:30Z")

</div>

Regex is not exposed because of its performance problems in Lucene 3.1. A wrapper around any Lucene query is not possible since you need to know how to "parse" the query representation, so it requires writing a plugin that adds a new type of query.

On Wednesday, June 1, 2011 at 3:41 PM, Weiwei Wang wrote:

> It's better to provide a LuceneQueryWrapperBuilder to wrap a lucene  
> query, in this way we can employ all the query functions provided by  
> Lucene/
> 
> On Jun 1, 5:21 pm, Clinton Gormley \<[clin...@iannounce.co.uk](mailto:clin...@iannounce.co.uk) ([http://iannounce.co.uk](http://iannounce.co.uk))\> wrote:
> 
> > On Tue, 2011-05-31 at 22:04 -0700, Weiwei Wang wrote:
> > 
> > > I need to do some regex search but can not find a QueryBuilder like  
> > > RegexQueryBuilder.
> > 
> > > how should i do regex search under ES?
> > 
> > Currently the RegexQueryBuilder isn't in ES. You can open an issue to  
> > have it included if you like. Not sure why Shay hasn't included it - he  
> > may have a reason
> > 
> > c

---

<div class="post-metadata">

**Author:** ![Weiwei\_Wang](https://avatars.discourse-cdn.com/v4/letter/w/b19c9b/32.png) [@Weiwei\_Wang](https://discuss.elastic.co/u/Weiwei_Wang)\
**Post date:** [June 2, 2011, 8:04am UTC](https://discuss.elastic.co/t/why-es-has-not-something-like-regexquerybuilder/4511/5 "2011-06-02T08:04:07Z")

</div>

gotcha, thanks shay~

On Jun 1, 8:43 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Regex is not exposed because of its performance problems in Lucene 3.1. A wrapper around any Lucene query is not possible since you need to know how to "parse" the query representation, so it requires writing a plugin that adds a new type of query.
> 
> On Wednesday, June 1, 2011 at 3:41 PM, Weiwei Wang wrote:
> 
> > It's better to provide a LuceneQueryWrapperBuilder to wrap a lucene  
> > query, in this way we can employ all the query functions provided by  
> > Lucene/
> 
> > On Jun 1, 5:21 pm, Clinton Gormley \<[clin...@iannounce.co.uk](mailto:clin...@iannounce.co.uk) ([http://iannounce.co.uk](http://iannounce.co.uk))\> wrote:
> > 
> > > On Tue, 2011-05-31 at 22:04 -0700, Weiwei Wang wrote:
> > > 
> > > > I need to do some regex search but can not find a QueryBuilder like  
> > > > RegexQueryBuilder.
> 
> > > > how should i do regex search under ES?
> 
> > > Currently the RegexQueryBuilder isn't in ES. You can open an issue to  
> > > have it included if you like. Not sure why Shay hasn't included it - he  
> > > may have a reason
> 
> > > c

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:04am UTC](https://discuss.elastic.co/t/why-es-has-not-something-like-regexquerybuilder/4511/6 "2017-07-06T04:04:53Z")

</div>


