# Issue for implementing analyzer

**URL:** <https://discuss.elastic.co/t/issue-for-implementing-analyzer/3738>\
**Category:** Elasticsearch\
**Created:** [January 4, 2011, 11:37am UTC](https://discuss.elastic.co/t/issue-for-implementing-analyzer/3738 "2011-01-04T11:37:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam\_4](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@Sam\_4](https://discuss.elastic.co/u/Sam_4)\
**Post date:** [January 4, 2011, 11:37am UTC](https://discuss.elastic.co/t/issue-for-implementing-analyzer/3738/1 "2011-01-04T11:37:39Z")

</div>

I configured analyzer in elasticsearch.yml with below define  
configuration :  
index :  
analysis :  
analyzer :  
default :  
tokenizer:lowercase

my json document contains:

{"id":"first","keyword":"robin"}  
{"id":"second","keyword":"ROBIN"}  
{"id":"Third","keyword":"robinson"}

After the setting I searched the string "r\*" which gives me the doc  
which contains robin ,ROBIN and robinson.

SearchResponse searchResponse = client.prepareSearch("test")  
.setSearchType(SearchType.DEFAULT)  
.setQuery(wildcardQuery("keyword","r\*"))

Then I searched for "R\*" This gave me the 0 hits.  
when i search for "r\*" ,this gave me the 3 hits.

Then I removed the setting from the yml file.  
Again i am getting the same result.

Why i am not getting the result for the query "R\*"?  
in both cases, i am not using any setting for analyzer when preparing  
the index.

Thanks

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [January 4, 2011, 11:58am UTC](https://discuss.elastic.co/t/issue-for-implementing-analyzer/3738/2 "2011-01-04T11:58:22Z")

</div>

> Then I searched for "R\*" This gave me the 0 hits.  
> when i search for "r\*" ,this gave me the 3 hits.

The wildcard search is a term search - the text isn't passed through the  
analyzer.

If you use a query\_string or field search instead, then the text IS  
passed through the analyzer, and by default lowercase\_expanded\_terms is  
set to true, so your search will work

clint

---

<div class="post-metadata">

**Author:** ![Sam\_4](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@Sam\_4](https://discuss.elastic.co/u/Sam_4)\
**Post date:** [January 4, 2011, 12:16pm UTC](https://discuss.elastic.co/t/issue-for-implementing-analyzer/3738/3 "2011-01-04T12:16:54Z")

</div>

thanks for quick reply.

i have some confusion regarding analyzer :

1. analyzer work first then index is created or index is prepared then  
analyzer will works.
2. if i am using explicit analyzer setting ,is it required to do some  
settings when index is prepared so that index uses the specified  
analyzer.

Thanks

On Jan 4, 4:58 pm, Clinton Gormley [clin...@iannounce.co.uk](mailto:clin...@iannounce.co.uk) wrote:

> > Then I searched for "R\*" This gave me the 0 hits.  
> > when i search for "r\*" ,this gave me the 3 hits.
> 
> The wildcard search is a term search - the text isn't passed through the  
> analyzer.
> 
> If you use a query\_string or field search instead, then the text IS  
> passed through the analyzer, and by default lowercase\_expanded\_terms is  
> set to true, so your search will work
> 
> clint

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [January 4, 2011, 12:28pm UTC](https://discuss.elastic.co/t/issue-for-implementing-analyzer/3738/4 "2011-01-04T12:28:11Z")

</div>

> i have some confusion regarding analyzer :
> 
> 1. analyzer work first then index is created or index is prepared then  
> analyzer will works.

I don't understand this question, but: when you index text, the current  
analyzer is used. If you change the current analyzer, the text that has  
already been indexed won't change (until you reindex it).

When you search with a query string or field search, the same current  
analyzer is applied

> 1. if i am using explicit analyzer setting ,is it required to do some  
> settings when index is prepared so that index uses the specified  
> analyzer.

Yes, see:  
[http://www.elasticsearch.com/docs/elasticsearch/index\_modules/analysis/](http://www.elasticsearch.com/docs/elasticsearch/index_modules/analysis/)

and to update the analyzer later:  
[http://www.elasticsearch.com/docs/elasticsearch/rest\_api/admin/indices/update\_settings/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/admin/indices/update_settings/)

clint

---

<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, 4:14am UTC](https://discuss.elastic.co/t/issue-for-implementing-analyzer/3738/5 "2017-07-06T04:14:24Z")

</div>


