WildCard Search not working on analyzed field


(Hanish Bansal) #1

Hi All,

I am facing an issue in exact wild-card searching on analyzed field.

I have below values of field1.

aj+bk
aj+mg
rr+nr

Now if i search for aj+bk then i am getting only one record that is *aj+bk
.
And if i search using wild card character for example j+bk then i am
getting 2 records that is aj+bk,aj+mg; But
expected records in second
search is 1 instead of returning 2 records
.

According to my observation, during wild card search, query string is
behaving like OR query and returning all the records which has at-least
one token match even I have mentioned AND operator in query.

My query is :

"{"query" : "+ QueryBuilders.queryString("field1"+ "+" +
input).analyzeWildcard(true).defaultOperator(Operator.AND).toString() + "}";

why AND searching is not working in case of leading wildcard search.

--
Thanks & Regards
Hanish Bansal

--
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.


(Adrien Grand) #2

Hi,

Is the '+' contained in your terms supposed to be an URL-encoded space or
is it an actual 'plus'? Can you provide us with a full curl recreation for
this issue?

Thanks.

--
Adrien Grand

--
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.


(Hanish Bansal) #3

It is actual 'plus' i.e +.

I am using java api to fire query. My final query becomes :

{
"filtered" : {
"query" : {
"match_all" : { }
},
"filter" : {
"wrapper" : {
"filter" : {"and":[{"query" : {
"query_string" : {
"query" : "field1:*j+bk",
"default_operator" : "and"
}
}}]}
}
}
}

On Mon, Sep 23, 2013 at 10:11 PM, Adrien Grand <
adrien.grand@elasticsearch.com> wrote:

Hi,

Is the '+' contained in your terms supposed to be an URL-encoded space or
is it an actual 'plus'? Can you provide us with a full curl recreation for
this issue?

Thanks.

--
Adrien Grand

--
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.

--
Thanks & Regards
Hanish Bansal

--
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.


(Adrien Grand) #4

Hi,

What analyzer are you using? Can you paste your mapping definition?

On Tue, Sep 24, 2013 at 8:45 AM, Hanish Bansal <
hanish.bansal.agarwal@gmail.com> wrote:

It is actual 'plus' i.e +.

I am using java api to fire query. My final query becomes :

{
"filtered" : {
"query" : {
"match_all" : { }
},
"filter" : {
"wrapper" : {
"filter" : {"and":[{"query" : {
"query_string" : {
"query" : "field1:*j+bk",
"default_operator" : "and"
}
}}]}
}
}
}

On Mon, Sep 23, 2013 at 10:11 PM, Adrien Grand <
adrien.grand@elasticsearch.com> wrote:

Hi,

Is the '+' contained in your terms supposed to be an URL-encoded space or
is it an actual 'plus'? Can you provide us with a full curl recreation for
this issue?

Thanks.

--
Adrien Grand

--
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.

--
Thanks & Regards
Hanish Bansal

--
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.

--
Adrien Grand

--
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.


(Hanish Bansal) #5

we are using default standard analyzer for field field1.

Index mapping is:

  1. {
  2. "tweetindex1":
    
  3. {
    
  4.     "tweet_ipdr":
    
  5.     {
    
  6.         "_source":
    
  7.         {
    
  8.             "enabled": false
    
  9.         },
    
  10.         "properties":
    
  11.         {
    
  12.             "field1":
    
  13.             {
    
  14.                 "type": "string",
    
  15.                 "store": true
    
  16.             },
    
  17.             "field2":
    
  18.             {
    
  19.                 "type": "string",
    
  20.                 "store": true
    
  21.             }
    
  22.         }
    
  23.     }
    
  24. }
    
  25. }

On Tue, Sep 24, 2013 at 2:04 PM, Adrien Grand <
adrien.grand@elasticsearch.com> wrote:

Hi,

What analyzer are you using? Can you paste your mapping definition?

On Tue, Sep 24, 2013 at 8:45 AM, Hanish Bansal <
hanish.bansal.agarwal@gmail.com> wrote:

It is actual 'plus' i.e +.

I am using java api to fire query. My final query becomes :

{
"filtered" : {
"query" : {
"match_all" : { }
},
"filter" : {
"wrapper" : {
"filter" : {"and":[{"query" : {
"query_string" : {
"query" : "field1:*j+bk",
"default_operator" : "and"
}
}}]}
}
}
}

On Mon, Sep 23, 2013 at 10:11 PM, Adrien Grand <
adrien.grand@elasticsearch.com> wrote:

Hi,

Is the '+' contained in your terms supposed to be an URL-encoded space
or is it an actual 'plus'? Can you provide us with a full curl recreation
for this issue?

Thanks.

--
Adrien Grand

--
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.

--
Thanks & Regards
Hanish Bansal

--
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.

--
Adrien Grand

--
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.

--
Thanks & Regards
Hanish Bansal

--
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) #6