# WildCard Search not working on analyzed field

**URL:** <https://discuss.elastic.co/t/wildcard-search-not-working-on-analyzed-field/13702>\
**Category:** Elasticsearch\
**Created:** [September 20, 2013, 10:46am UTC](https://discuss.elastic.co/t/wildcard-search-not-working-on-analyzed-field/13702 "2013-09-20T10:46:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hanish\_Bansal](https://avatars.discourse-cdn.com/v4/letter/h/e36b37/32.png) [@Hanish\_Bansal](https://discuss.elastic.co/u/Hanish_Bansal)\
**Post date:** [September 20, 2013, 10:46am UTC](https://discuss.elastic.co/t/wildcard-search-not-working-on-analyzed-field/13702/1 "2013-09-20T10:46:03Z")

</div>

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](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:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [September 23, 2013, 4:41pm UTC](https://discuss.elastic.co/t/wildcard-search-not-working-on-analyzed-field/13702/2 "2013-09-23T16:41:11Z")

</div>

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](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:** ![Hanish\_Bansal](https://avatars.discourse-cdn.com/v4/letter/h/e36b37/32.png) [@Hanish\_Bansal](https://discuss.elastic.co/u/Hanish_Bansal)\
**Post date:** [September 24, 2013, 6:45am UTC](https://discuss.elastic.co/t/wildcard-search-not-working-on-analyzed-field/13702/3 "2013-09-24T06:45:59Z")

</div>

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](mailto: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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](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](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:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [September 24, 2013, 8:34am UTC](https://discuss.elastic.co/t/wildcard-search-not-working-on-analyzed-field/13702/4 "2013-09-24T08:34:39Z")

</div>

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](mailto: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](mailto: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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](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](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:** ![Hanish\_Bansal](https://avatars.discourse-cdn.com/v4/letter/h/e36b37/32.png) [@Hanish\_Bansal](https://discuss.elastic.co/u/Hanish_Bansal)\
**Post date:** [September 25, 2013, 12:07pm UTC](https://discuss.elastic.co/t/wildcard-search-not-working-on-analyzed-field/13702/5 "2013-09-25T12:07:27Z")

</div>

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](mailto: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](mailto: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](mailto: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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](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](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:14am UTC](https://discuss.elastic.co/t/wildcard-search-not-working-on-analyzed-field/13702/6 "2017-07-06T02:14:45Z")

</div>


