Wildcards search in exact phrase in query_string search


(Ankit Jain) #1

Hi All,

We would want to include a wildcards in a query_string query when looking
for a phrase.
When we search with following query:
{
"query":{
"query_string":{
"default_operator" : "AND"
"analyze_wildcard": true,
"default_field":"value",
"query":""great match""
}
}
*Output: *4 records (returning all 4 records which contain "great match" in
phrase.)

But, when I search with below query:
{
"query":{
"query_string":{
"default_operator" : "AND"
"analyze_wildcard": true,
"default_field":"value",
"query":""great ma*""
}
}

Output: 10 records (returning all records which has either great or match
with ma* or both.)

is it possible to include a wildcards in a query_string query when looking
for a phrase?

Regards,
Ankit Jain

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(shadyabhi) #2

Hi Ankit,

Using of quotes in your "query" part is avoiding "*" from being
interpreted. To do what you want, have a look at a previous post:
http://elasticsearch-users.115913.n3.nabble.com/Wildcards-in-exact-phrase-in-query-string-search-td4020826.html

On Wed, Oct 9, 2013 at 12:17 PM, Ankit Jain ankitjaincs06@gmail.com wrote:

Hi All,

We would want to include a wildcards in a query_string query when looking
for a phrase.
When we search with following query:
{
"query":{
"query_string":{
"default_operator" : "AND"
"analyze_wildcard": true,
"default_field":"value",
"query":""great match""
}
}
Output: 4 records (returning all 4 records which contain "great match" in
phrase.)

But, when I search with below query:
{
"query":{
"query_string":{
"default_operator" : "AND"
"analyze_wildcard": true,
"default_field":"value",
"query":""great ma*""
}
}

Output: 10 records (returning all records which has either great or match
with ma* or both.)

is it possible to include a wildcards in a query_string query when looking
for a phrase?

Regards,
Ankit Jain

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
Regards,
Abhijeet Rastogi (shadyabhi)

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Ankit Jain) #3

Hi Abhijeet,

Thanks for the reply..

its an typo on query. We are using wildcard search (*) without quotes.

Below is the correct queries we are firing.
{
"query":{
"query_string":{
"default_operator" : "AND"
"analyze_wildcard": true,
"default_field":"value",
"query":great ma*
}
}

Regards,
Ankit

On Sunday, 13 October 2013 22:58:48 UTC+5:30, Abhijeet Rastogi wrote:

Hi Ankit,

Using of quotes in your "query" part is avoiding "*" from being
interpreted. To do what you want, have a look at a previous post:

http://elasticsearch-users.115913.n3.nabble.com/Wildcards-in-exact-phrase-in-query-string-search-td4020826.html

On Wed, Oct 9, 2013 at 12:17 PM, Ankit Jain <ankitj...@gmail.com<javascript:>>
wrote:

Hi All,

We would want to include a wildcards in a query_string query when
looking
for a phrase.
When we search with following query:
{
"query":{
"query_string":{
"default_operator" : "AND"
"analyze_wildcard": true,
"default_field":"value",
"query":""great match""
}
}
Output: 4 records (returning all 4 records which contain "great match"
in
phrase.)

But, when I search with below query:
{
"query":{
"query_string":{
"default_operator" : "AND"
"analyze_wildcard": true,
"default_field":"value",
"query":""great ma*""
}
}

Output: 10 records (returning all records which has either great or
match
with ma* or both.)

is it possible to include a wildcards in a query_string query when
looking
for a phrase?

Regards,
Ankit Jain

--
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 <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
Regards,
Abhijeet Rastogi (shadyabhi)

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4