Wildcards search in exact phrase in query_string search

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Wildcards search in exact phrase in query_string search

Ankit Jain
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Wildcards search in exact phrase in query_string search

shadyabhi
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 <[hidden email]> 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 [hidden email].
> 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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Wildcards search in exact phrase in query_string search

Ankit Jain
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 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="Oi70iwsNbT8J">ankitj...@...> 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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="Oi70iwsNbT8J">elasticsearc...@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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.