# Lucene based query string, analyzers and wildcard usage

**URL:** <https://discuss.elastic.co/t/lucene-based-query-string-analyzers-and-wildcard-usage/5628>\
**Category:** Elasticsearch\
**Created:** [October 18, 2011, 3:32pm UTC](https://discuss.elastic.co/t/lucene-based-query-string-analyzers-and-wildcard-usage/5628 "2011-10-18T15:32:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pulkitsinghal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pulkitsinghal/32/802_2.png) [@pulkitsinghal](https://discuss.elastic.co/u/pulkitsinghal)\
**Post date:** [October 18, 2011, 3:32pm UTC](https://discuss.elastic.co/t/lucene-based-query-string-analyzers-and-wildcard-usage/5628/1 "2011-10-18T15:32:01Z")

</div>

Hello,

My question might end up being a flaw in my understanding of Lucene  
but please humor me and let me know what is going on here.

I have the following data indexed:  
{"author":"PULKIT SINGHAL"}

But when I try any of the following searches, it does not yield  
results:  
curl -XGET '[http://localhost:9200/bbyopen/\_search?q=author:PULKIT](http://localhost:9200/bbyopen/_search?q=author:PULKIT)'  
curl -XGET '[http://localhost:9200/bbyopen/\_search?q=author:PULKIT\*](http://localhost:9200/bbyopen/_search?q=author:PULKIT*)'

The only time I get a result is with:  
curl -XGET '[http://localhost:9200/bbyopen/\_search?q=author:PULKIT](http://localhost:9200/bbyopen/_search?q=author:PULKIT)  
%20SINGHAL'

Can anyone help me understand what is going on here?

I checked how the data is being analyzed by running:  
tiklup-mac:~ pulkitsinghal$ curl -XGET '[http://localhost:9200/bbyopen/](http://localhost:9200/bbyopen/)  
\_analyze?pretty=true' -d 'PULKIT SINGHAL'

And it is understandably being divided into two terms - "pulkit" and  
"singhal"  
{  
"tokens" : [ {  
"token" : "pulkit",  
"start\_offset" : 0,  
"end\_offset" : 6,  
"type" : "",  
"position" : 1  
}, {  
"token" : "singhal",  
"start\_offset" : 7,  
"end\_offset" : 14,  
"type" : "",  
"position" : 2  
} ]

Then why wouldn't this query match:  
curl -XGET '[http://localhost:9200/bbyopen/\_search?q=author:PULKIT](http://localhost:9200/bbyopen/_search?q=author:PULKIT)'  
It has one of the terms from the analyzed results in it.

Also what about the query with the wildcard:  
curl -XGET '[http://localhost:9200/bbyopen/\_search?q=author:PULKIT\*](http://localhost:9200/bbyopen/_search?q=author:PULKIT*)'  
why is it failing?

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [October 19, 2011, 8:04am UTC](https://discuss.elastic.co/t/lucene-based-query-string-analyzers-and-wildcard-usage/5628/2 "2011-10-19T08:04:40Z")

</div>

did you tried it with the query\_string query too?

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

On 18 Okt., 17:32, pulkitsinghal [pulkitsing...@gmail.com](mailto:pulkitsing...@gmail.com) wrote:

> Hello,
> 
> My question might end up being a flaw in my understanding of Lucene  
> but please humor me and let me know what is going on here.
> 
> I have the following data indexed:  
> {"author":"PULKIT SINGHAL"}
> 
> But when I try any of the following searches, it does not yield  
> results:  
> curl -XGET '[http://localhost:9200/bbyopen/\_search?q=author:PULKIT](http://localhost:9200/bbyopen/_search?q=author:PULKIT)'  
> curl -XGET '[http://localhost:9200/bbyopen/\_search?q=author:PULKIT](http://localhost:9200/bbyopen/_search?q=author:PULKIT)\*'
> 
> The only time I get a result is with:  
> curl -XGET '[http://localhost:9200/bbyopen/\_search?q=author:PULKIT](http://localhost:9200/bbyopen/_search?q=author:PULKIT)  
> %20SINGHAL'
> 
> Can anyone help me understand what is going on here?
> 
> I checked how the data is being analyzed by running:  
> tiklup-mac:~ pulkitsinghal$ curl -XGET '[http://localhost:9200/bbyopen/](http://localhost:9200/bbyopen/)  
> \_analyze?pretty=true' -d 'PULKIT SINGHAL'
> 
> And it is understandably being divided into two terms - "pulkit" and  
> "singhal"  
> {  
> "tokens" : [ {  
> "token" : "pulkit",  
> "start\_offset" : 0,  
> "end\_offset" : 6,  
> "type" : "",  
> "position" : 1  
> }, {  
> "token" : "singhal",  
> "start\_offset" : 7,  
> "end\_offset" : 14,  
> "type" : "",  
> "position" : 2  
> } ]
> 
> Then why wouldn't this query match:  
> curl -XGET '[http://localhost:9200/bbyopen/\_search?q=author:PULKIT](http://localhost:9200/bbyopen/_search?q=author:PULKIT)'  
> It has one of the terms from the analyzed results in it.
> 
> Also what about the query with the wildcard:  
> curl -XGET '[http://localhost:9200/bbyopen/\_search?q=author:PULKIT](http://localhost:9200/bbyopen/_search?q=author:PULKIT)\*'  
> why is it failing?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [October 19, 2011, 9:09pm UTC](https://discuss.elastic.co/t/lucene-based-query-string-analyzers-and-wildcard-usage/5628/3 "2011-10-19T21:09:51Z")

</div>

Is the field analyzed or not? Can you gist a full recreation as explained  
here: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help).

On Tue, Oct 18, 2011 at 5:32 PM, pulkitsinghal [pulkitsinghal@gmail.com](mailto:pulkitsinghal@gmail.com)wrote:

> Hello,
> 
> My question might end up being a flaw in my understanding of Lucene  
> but please humor me and let me know what is going on here.
> 
> I have the following data indexed:  
> {"author":"PULKIT SINGHAL"}
> 
> But when I try any of the following searches, it does not yield  
> results:  
> curl -XGET '[http://localhost:9200/bbyopen/\_search?q=author:PULKIT](http://localhost:9200/bbyopen/_search?q=author:PULKIT)'  
> curl -XGET '[http://localhost:9200/bbyopen/\_search?q=author:PULKIT](http://localhost:9200/bbyopen/_search?q=author:PULKIT)\*'
> 
> The only time I get a result is with:  
> curl -XGET '[http://localhost:9200/bbyopen/\_search?q=author:PULKIT](http://localhost:9200/bbyopen/_search?q=author:PULKIT)  
> %20SINGHAL'
> 
> Can anyone help me understand what is going on here?
> 
> I checked how the data is being analyzed by running:  
> tiklup-mac:~ pulkitsinghal$ curl -XGET '[http://localhost:9200/bbyopen/](http://localhost:9200/bbyopen/)  
> \_analyze?pretty=true' -d 'PULKIT SINGHAL'
> 
> And it is understandably being divided into two terms - "pulkit" and  
> "singhal"  
> {  
> "tokens" : [ {  
> "token" : "pulkit",  
> "start\_offset" : 0,  
> "end\_offset" : 6,  
> "type" : "",  
> "position" : 1  
> }, {  
> "token" : "singhal",  
> "start\_offset" : 7,  
> "end\_offset" : 14,  
> "type" : "",  
> "position" : 2  
> } ]
> 
> Then why wouldn't this query match:  
> curl -XGET '[http://localhost:9200/bbyopen/\_search?q=author:PULKIT](http://localhost:9200/bbyopen/_search?q=author:PULKIT)'  
> It has one of the terms from the analyzed results in it.
> 
> Also what about the query with the wildcard:  
> curl -XGET '[http://localhost:9200/bbyopen/\_search?q=author:PULKIT](http://localhost:9200/bbyopen/_search?q=author:PULKIT)\*'  
> why is it failing?

---

<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, 3:51am UTC](https://discuss.elastic.co/t/lucene-based-query-string-analyzers-and-wildcard-usage/5628/4 "2017-07-06T03:51:21Z")

</div>


