# Regexp query flags documentation bug?

**URL:** <https://discuss.elastic.co/t/regexp-query-flags-documentation-bug/16726>\
**Category:** Elasticsearch\
**Created:** [March 31, 2014, 9:03pm UTC](https://discuss.elastic.co/t/regexp-query-flags-documentation-bug/16726 "2014-03-31T21:03:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jamil\_Bou\_Kheir\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jamil_bou_kheir_2/32/1683_2.png) [@Jamil\_Bou\_Kheir\_2](https://discuss.elastic.co/u/Jamil_Bou_Kheir_2)\
**Post date:** [March 31, 2014, 9:03pm UTC](https://discuss.elastic.co/t/regexp-query-flags-documentation-bug/16726/1 "2014-03-31T21:03:58Z")

</div>

Hello,

I'm encountering some unexpected behavior when using the regexp query. I  
get zero results when I use the syntax given in the documentation[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html)  
:

{  
"regexp":{  
"name.first": "s.\*y",  
"flags" : "INTERSECTION|COMPLEMENT|EMPTY"  
}  
}

However, if I change the syntax to the following, results are returned:

{  
"regexp":{  
"name.first":{  
"value" : "s.\*y",  
"flags" : "INTERSECTION|COMPLEMENT|EMPTY"  
}  
}  
}

I tested this on 0.90.5, 1.0.0, and 1.1.0 with the same results. Can anyone  
confirm?

Jamil

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/52ad8946-2663-4533-a392-ff52155e8ec3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/52ad8946-2663-4533-a392-ff52155e8ec3%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Jamil\_Bou\_Kheir\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jamil_bou_kheir_2/32/1683_2.png) [@Jamil\_Bou\_Kheir\_2](https://discuss.elastic.co/u/Jamil_Bou_Kheir_2)\
**Post date:** [March 31, 2014, 9:07pm UTC](https://discuss.elastic.co/t/regexp-query-flags-documentation-bug/16726/2 "2014-03-31T21:07:05Z")

</div>

I should add that this only occurs within a filtered query, e.g.

{  
"query": {  
"filtered": {  
"filter": {  
"regexp": {  
"name.first": "s.\*y",  
"flags": "ALL"  
}  
}  
}  
}  
}

On Monday, March 31, 2014 2:03:58 PM UTC-7, Jamil Bou Kheir wrote:

> Hello,
> 
> I'm encountering some unexpected behavior when using the regexp query. I  
> get zero results when I use the syntax given in the documentation[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html)  
> :
> 
> {  
> "regexp":{  
> "name.first": "s.\*y",  
> "flags" : "INTERSECTION|COMPLEMENT|EMPTY"  
> }  
> }
> 
> However, if I change the syntax to the following, results are returned:
> 
> {  
> "regexp":{  
> "name.first":{  
> "value" : "s.\*y",  
> "flags" : "INTERSECTION|COMPLEMENT|EMPTY"  
> }  
> }  
> }
> 
> I tested this on 0.90.5, 1.0.0, and 1.1.0 with the same results. Can  
> anyone confirm?
> 
> Jamil

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/728f4123-6d10-4e2f-82c7-8992c3d3d1c8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/728f4123-6d10-4e2f-82c7-8992c3d3d1c8%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly\_2](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@Binh\_Ly\_2](https://discuss.elastic.co/u/Binh_Ly_2)\
**Post date:** [April 1, 2014, 6:45pm UTC](https://discuss.elastic.co/t/regexp-query-flags-documentation-bug/16726/3 "2014-04-01T18:45:13Z")

</div>

Thanks, that is an error in the docs and submitted a correction already.  
Your second syntax is the correct one.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/777af59c-78dd-42c1-877c-7213dc3b6163%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/777af59c-78dd-42c1-877c-7213dc3b6163%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:38am UTC](https://discuss.elastic.co/t/regexp-query-flags-documentation-bug/16726/4 "2017-07-06T01:38:57Z")

</div>


