Regexp with * returns no matches while .* does

Hi,

I have a index of documents, where all string fields are not_analyzed, and
when I try to query by regex filter, I get a weird results:

{
"size" : 1,
"query" : {
"filtered" : {
"filter" : {
"regexp" : {
"name" : "v*"
}
}
}
}
}

returns no documents, however

{
"size" : 1,
"query" : {
"filtered" : {
"filter" : {
"regexp" : {
"name" : "v.*"
}
}
}
}
}

works fine - the only difference being the regexp "v*" vs. "v.*".

Thanks for any 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/5671eaec-1ff5-4e63-b434-ec9d82a20fec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

This is how regex works.
v = The word must start with the character "v"
. = Any character after "v"

  • = Zero or more characters after "." till the end of the row

Am Donnerstag, 23. Oktober 2014 08:27:24 UTC+2 schrieb Gargoyle:

Hi,

I have a index of documents, where all string fields are not_analyzed, and
when I try to query by regex filter, I get a weird results:

{
"size" : 1,
"query" : {
"filtered" : {
"filter" : {
"regexp" : {
"name" : "v*"
}
}
}
}
}

returns no documents, however

{
"size" : 1,
"query" : {
"filtered" : {
"filter" : {
"regexp" : {
"name" : "v.*"
}
}
}
}
}

works fine - the only difference being the regexp "v*" vs. "v.*".

Thanks for any 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/44d071bb-f53d-4a4f-bd91-b53498738e0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yes, I get that, but I do not get why "v*" does not work, since that is
"Word must start with 'v'"

On Thursday, October 23, 2014 9:24:51 AM UTC+2, Ramy wrote:

This is how regex works.
v = The word must start with the character "v"
. = Any character after "v"

  • = Zero or more characters after "." till the end of the row

Am Donnerstag, 23. Oktober 2014 08:27:24 UTC+2 schrieb Gargoyle:

Hi,

I have a index of documents, where all string fields are not_analyzed,
and when I try to query by regex filter, I get a weird results:

{
"size" : 1,
"query" : {
"filtered" : {
"filter" : {
"regexp" : {
"name" : "v*"
}
}
}
}
}

returns no documents, however

{
"size" : 1,
"query" : {
"filtered" : {
"filter" : {
"regexp" : {
"name" : "v.*"
}
}
}
}
}

works fine - the only difference being the regexp "v*" vs. "v.*".

Thanks for any 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4cc03086-9236-4495-bee8-261dd0ee3e37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

it would work if you have a word like: "vvvvvvvvvvvvvvv(n)"

Am Donnerstag, 23. Oktober 2014 09:44:36 UTC+2 schrieb Gargoyle:

Yes, I get that, but I do not get why "v*" does not work, since that is
"Word must start with 'v'"

On Thursday, October 23, 2014 9:24:51 AM UTC+2, Ramy wrote:

This is how regex works.
v = The word must start with the character "v"
. = Any character after "v"

  • = Zero or more characters after "." till the end of the row

Am Donnerstag, 23. Oktober 2014 08:27:24 UTC+2 schrieb Gargoyle:

Hi,

I have a index of documents, where all string fields are not_analyzed,
and when I try to query by regex filter, I get a weird results:

{
"size" : 1,
"query" : {
"filtered" : {
"filter" : {
"regexp" : {
"name" : "v*"
}
}
}
}
}

returns no documents, however

{
"size" : 1,
"query" : {
"filtered" : {
"filter" : {
"regexp" : {
"name" : "v.*"
}
}
}
}
}

works fine - the only difference being the regexp "v*" vs. "v.*".

Thanks for any 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4fa7fb2e-cbf2-4f75-876f-efa461040e2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Oh, Thank You!

On Thursday, October 23, 2014 9:58:23 AM UTC+2, Ramy wrote:

it would work if you have a word like: "vvvvvvvvvvvvvvv(n)"

Am Donnerstag, 23. Oktober 2014 09:44:36 UTC+2 schrieb Gargoyle:

Yes, I get that, but I do not get why "v*" does not work, since that is
"Word must start with 'v'"

On Thursday, October 23, 2014 9:24:51 AM UTC+2, Ramy wrote:

This is how regex works.
v = The word must start with the character "v"
. = Any character after "v"

  • = Zero or more characters after "." till the end of the row

Am Donnerstag, 23. Oktober 2014 08:27:24 UTC+2 schrieb Gargoyle:

Hi,

I have a index of documents, where all string fields are not_analyzed,
and when I try to query by regex filter, I get a weird results:

{
"size" : 1,
"query" : {
"filtered" : {
"filter" : {
"regexp" : {
"name" : "v*"
}
}
}
}
}

returns no documents, however

{
"size" : 1,
"query" : {
"filtered" : {
"filter" : {
"regexp" : {
"name" : "v.*"
}
}
}
}
}

works fine - the only difference being the regexp "v*" vs. "v.*".

Thanks for any 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e68c32e2-f83c-4deb-8e53-98b18aa4b1a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.