# Regexp Query Not working

**URL:** <https://discuss.elastic.co/t/regexp-query-not-working/14562>\
**Category:** Elasticsearch\
**Created:** [November 24, 2013, 7:39am UTC](https://discuss.elastic.co/t/regexp-query-not-working/14562 "2013-11-24T07:39:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![deep\_saxena](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@deep\_saxena](https://discuss.elastic.co/u/deep_saxena)\
**Post date:** [November 24, 2013, 7:39am UTC](https://discuss.elastic.co/t/regexp-query-not-working/14562/1 "2013-11-24T07:39:16Z")

</div>

{  
"query": {  
"regexp": {  
"first.name[http://www.google.com/url?q=http%3A%2F%2Ffirst.name&sa=D&sntz=1&usg=AFQjCNEC43YiZFrdxW8r9fyMwpkaS5sveQ](http://www.google.com/url?q=http%3A%2F%2Ffirst.name&sa=D&sntz=1&usg=AFQjCNEC43YiZFrdxW8r9fyMwpkaS5sveQ)":  
"s\*",  
"flags": "EMPTY"  
}  
}  
}

There is the indexed data

1. Summon in the statement
2. sussy, lussy like names in the elasticsearch server.

What is the exact JSON object that we can query???  
Any mistakes and suggestion.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 24, 2013, 7:44am UTC](https://discuss.elastic.co/t/regexp-query-not-working/14562/2 "2013-11-24T07:44:56Z")

</div>

Hey,

check your regex, you are most likely searching for "s.\*"?

--Alex

On Sun, Nov 24, 2013 at 8:39 AM, deep saxena [sandy100ster@gmail.com](mailto:sandy100ster@gmail.com) wrote:

> {  
> "query": {  
> "regexp": {  
> "first.name[http://www.google.com/url?q=http%3A%2F%2Ffirst.name&sa=D&sntz=1&usg=AFQjCNEC43YiZFrdxW8r9fyMwpkaS5sveQ](http://www.google.com/url?q=http%3A%2F%2Ffirst.name&sa=D&sntz=1&usg=AFQjCNEC43YiZFrdxW8r9fyMwpkaS5sveQ)":  
> "s\*",  
> "flags": "EMPTY"  
> }  
> }  
> }
> 
> There is the indexed data
> 
> 1. Summon in the statement
> 2. sussy, lussy like names in the elasticsearch server.
> 
> What is the exact JSON object that we can query???  
> Any mistakes and suggestion.
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![deep\_saxena](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@deep\_saxena](https://discuss.elastic.co/u/deep_saxena)\
**Post date:** [November 24, 2013, 7:56am UTC](https://discuss.elastic.co/t/regexp-query-not-working/14562/3 "2013-11-24T07:56:52Z")

</div>

The string should return s followed by any character like sussy, summon any  
thing with s and followed by nay number of charcter.  
It returns like this :-  
{

- took: 19
- timed\_out: false
- \_shards: {
  - total: 5
  - successful: 5
  - failed: 0  
}

- hits: {
  - total: 0
  - max\_score: null
  - hits:   
}

}

Am I doing anything wrong here ???

On Sunday, 24 November 2013 13:14:56 UTC+5:30, Alexander Reelsen wrote:

> Hey,
> 
> check your regex, you are most likely searching for "s.\*"?
> 
> --Alex
> 
> On Sun, Nov 24, 2013 at 8:39 AM, deep saxena \<[sandy1...@gmail.com](mailto:sandy1...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > {  
> > "query": {  
> > "regexp": {  
> > "first.name[http://www.google.com/url?q=http%3A%2F%2Ffirst.name&sa=D&sntz=1&usg=AFQjCNEC43YiZFrdxW8r9fyMwpkaS5sveQ](http://www.google.com/url?q=http%3A%2F%2Ffirst.name&sa=D&sntz=1&usg=AFQjCNEC43YiZFrdxW8r9fyMwpkaS5sveQ)":  
> > "s\*",  
> > "flags": "EMPTY"  
> > }  
> > }  
> > }
> > 
> > There is the indexed data
> > 
> > 1. Summon in the statement
> > 2. sussy, lussy like names in the elasticsearch server.
> > 
> > What is the exact JSON object that we can query???  
> > Any mistakes and suggestion.
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 24, 2013, 8:38am UTC](https://discuss.elastic.co/t/regexp-query-not-working/14562/4 "2013-11-24T08:38:03Z")

</div>

I'd suggest a full curl recreation here. See [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help)

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 24 nov. 2013 à 08:56, deep saxena [sandy100ster@gmail.com](mailto:sandy100ster@gmail.com) a écrit :

> The string should return s followed by any character like sussy, summon any thing with s and followed by nay number of charcter.  
> It returns like this :-  
> {  
> took: 19  
> timed\_out: false  
> \_shards: {  
> total: 5  
> successful: 5  
> failed: 0  
> }  
> hits: {  
> total: 0  
> max\_score: null  
> hits:   
> }  
> }
> 
> Am I doing anything wrong here ???
> 
> On Sunday, 24 November 2013 13:14:56 UTC+5:30, Alexander Reelsen wrote:
> 
> > Hey,
> > 
> > check your regex, you are most likely searching for "s.\*"?
> > 
> > --Alex
> > 
> > On Sun, Nov 24, 2013 at 8:39 AM, deep saxena [sandy1...@gmail.com](mailto:sandy1...@gmail.com) wrote:
> > 
> > > {  
> > > "query": {  
> > > "regexp": {  
> > > "first.name": "s\*",  
> > > "flags": "EMPTY"  
> > > }  
> > > }  
> > > }
> > > 
> > > There is the indexed data
> > > 
> > > 1. Summon in the statement
> > > 2. sussy, lussy like names in the elasticsearch server.
> > > 
> > > What is the exact JSON object that we can query???  
> > > Any mistakes and suggestion.
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 24, 2013, 8:44am UTC](https://discuss.elastic.co/t/regexp-query-not-working/14562/5 "2013-11-24T08:44:54Z")

</div>

Hey,

this is exactly what the regex "s._" does, as opposed to "s_", which only  
matches for an arbitrary amount of 's' letters. So "ss" or "sss" would  
match, but not "sus"...

--Alex

On Sun, Nov 24, 2013 at 8:56 AM, deep saxena [sandy100ster@gmail.com](mailto:sandy100ster@gmail.com) wrote:

> The string should return s followed by any character like sussy, summon  
> any thing with s and followed by nay number of charcter.  
> It returns like this :-  
> {
> 
> - took: 19
> - timed\_out: false
> - \_shards: {
> - total: 5
> - successful: 5
> - failed: 0  
> }
> 
> - hits: {
> - total: 0
> - max\_score: null
> - hits:   
> }
> 
> }
> 
> Am I doing anything wrong here ???
> 
> On Sunday, 24 November 2013 13:14:56 UTC+5:30, Alexander Reelsen wrote:
> 
> > Hey,
> > 
> > check your regex, you are most likely searching for "s.\*"?
> > 
> > --Alex
> > 
> > On Sun, Nov 24, 2013 at 8:39 AM, deep saxena [sandy1...@gmail.com](mailto:sandy1...@gmail.com) wrote:
> > 
> > > {  
> > > "query": {  
> > > "regexp": {  
> > > "first.name[http://www.google.com/url?q=http%3A%2F%2Ffirst.name&sa=D&sntz=1&usg=AFQjCNEC43YiZFrdxW8r9fyMwpkaS5sveQ](http://www.google.com/url?q=http%3A%2F%2Ffirst.name&sa=D&sntz=1&usg=AFQjCNEC43YiZFrdxW8r9fyMwpkaS5sveQ)":  
> > > "s\*",  
> > > "flags": "EMPTY"  
> > > }  
> > > }  
> > > }
> > > 
> > > There is the indexed data
> > > 
> > > 1. Summon in the statement
> > > 2. sussy, lussy like names in the elasticsearch server.
> > > 
> > > What is the exact JSON object that we can query???  
> > > Any mistakes and suggestion.
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > 
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > 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).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![deep\_saxena](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@deep\_saxena](https://discuss.elastic.co/u/deep_saxena)\
**Post date:** [November 25, 2013, 7:20am UTC](https://discuss.elastic.co/t/regexp-query-not-working/14562/6 "2013-11-25T07:20:13Z")

</div>

Thanx got the clear idea

On Sunday, 24 November 2013 14:14:54 UTC+5:30, Alexander Reelsen wrote:

> Hey,
> 
> this is exactly what the regex "s._" does, as opposed to "s_", which only  
> matches for an arbitrary amount of 's' letters. So "ss" or "sss" would  
> match, but not "sus"...
> 
> --Alex
> 
> On Sun, Nov 24, 2013 at 8:56 AM, deep saxena \<[sandy1...@gmail.com](mailto:sandy1...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > The string should return s followed by any character like sussy, summon  
> > any thing with s and followed by nay number of charcter.  
> > It returns like this :-  
> > {
> > 
> > - took: 19
> > - timed\_out: false
> > - \_shards: {
> > - total: 5
> > - successful: 5
> > - failed: 0  
> > }
> > 
> > - hits: {
> > - total: 0
> > - max\_score: null
> > - hits:   
> > }
> > 
> > }
> > 
> > Am I doing anything wrong here ???
> > 
> > On Sunday, 24 November 2013 13:14:56 UTC+5:30, Alexander Reelsen wrote:
> > 
> > > Hey,
> > > 
> > > check your regex, you are most likely searching for "s.\*"?
> > > 
> > > --Alex
> > > 
> > > On Sun, Nov 24, 2013 at 8:39 AM, deep saxena [sandy1...@gmail.com](mailto:sandy1...@gmail.com)wrote:
> > > 
> > > > {  
> > > > "query": {  
> > > > "regexp": {  
> > > > "first.name[http://www.google.com/url?q=http%3A%2F%2Ffirst.name&sa=D&sntz=1&usg=AFQjCNEC43YiZFrdxW8r9fyMwpkaS5sveQ](http://www.google.com/url?q=http%3A%2F%2Ffirst.name&sa=D&sntz=1&usg=AFQjCNEC43YiZFrdxW8r9fyMwpkaS5sveQ)":  
> > > > "s\*",  
> > > > "flags": "EMPTY"  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > There is the indexed data
> > > > 
> > > > 1. Summon in the statement
> > > > 2. sussy, lussy like names in the elasticsearch server.
> > > > 
> > > > What is the exact JSON object that we can query???  
> > > > Any mistakes and suggestion.
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > > 
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![deep\_saxena](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@deep\_saxena](https://discuss.elastic.co/u/deep_saxena)\
**Post date:** [November 25, 2013, 7:22am UTC](https://discuss.elastic.co/t/regexp-query-not-working/14562/7 "2013-11-25T07:22:30Z")

</div>

Does elasticsearch does not support java regular expression? if yes could  
you please give some example or link, if not then why??

On Monday, 25 November 2013 12:50:13 UTC+5:30, deep saxena wrote:

> Thanx got the clear idea
> 
> On Sunday, 24 November 2013 14:14:54 UTC+5:30, Alexander Reelsen wrote:
> 
> > Hey,
> > 
> > this is exactly what the regex "s._" does, as opposed to "s_", which only  
> > matches for an arbitrary amount of 's' letters. So "ss" or "sss" would  
> > match, but not "sus"...
> > 
> > --Alex
> > 
> > On Sun, Nov 24, 2013 at 8:56 AM, deep saxena [sandy1...@gmail.com](mailto:sandy1...@gmail.com) wrote:
> > 
> > > The string should return s followed by any character like sussy, summon  
> > > any thing with s and followed by nay number of charcter.  
> > > It returns like this :-  
> > > {
> > > 
> > > - took: 19
> > > - timed\_out: false
> > > - \_shards: {
> > > - total: 5
> > > - successful: 5
> > > - failed: 0  
> > > }
> > > 
> > > - hits: {
> > > - total: 0
> > > - max\_score: null
> > > - hits:   
> > > }
> > > 
> > > }
> > > 
> > > Am I doing anything wrong here ???
> > > 
> > > On Sunday, 24 November 2013 13:14:56 UTC+5:30, Alexander Reelsen wrote:
> > > 
> > > > Hey,
> > > > 
> > > > check your regex, you are most likely searching for "s.\*"?
> > > > 
> > > > --Alex
> > > > 
> > > > On Sun, Nov 24, 2013 at 8:39 AM, deep saxena [sandy1...@gmail.com](mailto:sandy1...@gmail.com)wrote:
> > > > 
> > > > > {  
> > > > > "query": {  
> > > > > "regexp": {  
> > > > > "first.name[http://www.google.com/url?q=http%3A%2F%2Ffirst.name&sa=D&sntz=1&usg=AFQjCNEC43YiZFrdxW8r9fyMwpkaS5sveQ](http://www.google.com/url?q=http%3A%2F%2Ffirst.name&sa=D&sntz=1&usg=AFQjCNEC43YiZFrdxW8r9fyMwpkaS5sveQ)":  
> > > > > "s\*",  
> > > > > "flags": "EMPTY"  
> > > > > }  
> > > > > }  
> > > > > }
> > > > > 
> > > > > There is the indexed data
> > > > > 
> > > > > 1. Summon in the statement
> > > > > 2. sussy, lussy like names in the elasticsearch server.
> > > > > 
> > > > > What is the exact JSON object that we can query???  
> > > > > Any mistakes and suggestion.
> > > > > 
> > > > > --  
> > > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > > > 
> > > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![deep\_saxena](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@deep\_saxena](https://discuss.elastic.co/u/deep_saxena)\
**Post date:** [November 25, 2013, 8:46am UTC](https://discuss.elastic.co/t/regexp-query-not-working/14562/8 "2013-11-25T08:46:52Z")

</div>

Does elasticsearch does not support java regular expression? if yes could  
you please give some example or link, if not then why??

On Sunday, 24 November 2013 13:09:16 UTC+5:30, deep saxena wrote:

> {  
> "query": {  
> "regexp": {  
> "first.name[http://www.google.com/url?q=http%3A%2F%2Ffirst.name&sa=D&sntz=1&usg=AFQjCNEC43YiZFrdxW8r9fyMwpkaS5sveQ](http://www.google.com/url?q=http%3A%2F%2Ffirst.name&sa=D&sntz=1&usg=AFQjCNEC43YiZFrdxW8r9fyMwpkaS5sveQ)":  
> "s\*",  
> "flags": "EMPTY"  
> }  
> }  
> }
> 
> There is the indexed data
> 
> 1. Summon in the statement
> 2. sussy, lussy like names in the elasticsearch server.
> 
> What is the exact JSON object that we can query???  
> Any mistakes and suggestion.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:05am UTC](https://discuss.elastic.co/t/regexp-query-not-working/14562/9 "2017-07-06T02:05:05Z")

</div>


