# Elision Token Filter with custom analyzer?

**URL:** <https://discuss.elastic.co/t/elision-token-filter-with-custom-analyzer/6581>\
**Category:** Elasticsearch\
**Created:** [February 3, 2012, 6:22am UTC](https://discuss.elastic.co/t/elision-token-filter-with-custom-analyzer/6581 "2012-02-03T06:22:42Z")\
**Posts on this page:** 8\
**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:** [February 3, 2012, 6:22am UTC](https://discuss.elastic.co/t/elision-token-filter-with-custom-analyzer/6581/1 "2012-02-03T06:22:42Z")

</div>

Hi

I have applied Elision Token Filter while indexing and searching,i  
created an index for “l’avion” and searched for "avion" and got the  
hits as “l’avion”.  
this is correct and i believe that analyzer are done correctly for  
Elision.  
but when i search for “l’avion” i got zero hits.i was expecting one  
hits.because i am searching the same which i indexed.

why i couldn't get the hit? if i have misunderstood the concept then  
make it correct.

used custom analyzer settings :

{  
"index" : {  
"analysis" : {  
"analyzer" : {  
"manualindexanalyzer" : {  
"type":"custom",  
"tokenizer" : "whitespace",  
"filter" : ["lowercase","asciifolding","length","myelision"],  
"char\_filter" :["html\_strip"]  
},  
"manualsearchanalyzer" : {  
"type":"custom",  
"tokenizer" : "whitespace",  
"filter" : ["lowercase","asciifolding","length","myelision"],  
"char\_filter" :["html\_strip"]  
}  
},  
"filter" : {  
"myelision":{  
"type" : "elision",  
"articles" :["l", "m", "t", "qu", "n", "s", "j"]  
}  
}  
}  
}  
}

Mapping :

{  
"test\_type" : {  
"index\_analyzer" : "manualindexanalyzer",  
"search\_analyzer" : "manualsearchanalyzer"  
}  
}

to put mapping i have used following java code:

PutMappingResponse actionGet =  
client.admin().indices().preparePutMapping(indexName).setType(indexType).setSource(analyzerMapping).execute().actionGet();  
boolean acknowledged = actionGet.getAcknowledged();  
logger.debug("put mapping acknowledged::" + acknowledged);

Thanks

---

<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:** [February 5, 2012, 11:30am UTC](https://discuss.elastic.co/t/elision-token-filter-with-custom-analyzer/6581/2 "2012-02-05T11:30:26Z")

</div>

If the search analyzer is configured with the same elision filter, then it will be applied when searching as well, but only on queries that do analysis on the search text (query\_string, text, field). Which query did you execute?

On Friday, February 3, 2012 at 8:22 AM, sam wrote:

> Hi
> 
> I have applied Elision Token Filter while indexing and searching,i  
> created an index for “l’avion” and searched for "avion" and got the  
> hits as “l’avion”.  
> this is correct and i believe that analyzer are done correctly for  
> Elision.  
> but when i search for “l’avion” i got zero hits.i was expecting one  
> hits.because i am searching the same which i indexed.
> 
> why i couldn't get the hit? if i have misunderstood the concept then  
> make it correct.
> 
> used custom analyzer settings :
> 
> {  
> "index" : {  
> "analysis" : {  
> "analyzer" : {  
> "manualindexanalyzer" : {  
> "type":"custom",  
> "tokenizer" : "whitespace",  
> "filter" : ["lowercase","asciifolding","length","myelision"],  
> "char\_filter" :["html\_strip"]  
> },  
> "manualsearchanalyzer" : {  
> "type":"custom",  
> "tokenizer" : "whitespace",  
> "filter" : ["lowercase","asciifolding","length","myelision"],  
> "char\_filter" :["html\_strip"]  
> }  
> },  
> "filter" : {  
> "myelision":{  
> "type" : "elision",  
> "articles" :["l", "m", "t", "qu", "n", "s", "j"]  
> }  
> }  
> }  
> }  
> }
> 
> Mapping :
> 
> {  
> "test\_type" : {  
> "index\_analyzer" : "manualindexanalyzer",  
> "search\_analyzer" : "manualsearchanalyzer"  
> }  
> }
> 
> to put mapping i have used following java code:
> 
> PutMappingResponse actionGet =  
> client.admin().indices().preparePutMapping(indexName).setType(indexType).setSource(analyzerMapping).execute().actionGet();  
> boolean acknowledged = actionGet.getAcknowledged();  
> logger.debug("put mapping acknowledged::" + acknowledged);
> 
> Thanks

---

<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:** [February 7, 2012, 4:54am UTC](https://discuss.elastic.co/t/elision-token-filter-with-custom-analyzer/6581/3 "2012-02-07T04:54:41Z")

</div>

Thanks for reply.

Mapping :  
{  
"test\_type" : {  
"index\_analyzer" : "manualindexanalyzer",  
"search\_analyzer" : "manualsearchanalyzer"  
}  
}

Here I have putting mapping to configured the index\_analyzer and  
search\_analyzer,so it is not necessary to explicit define analyzer  
when doing a search.  
In my case which i pointed out in above question i have used  
index\_analyzer and search\_analyzer both are same when index is  
created.for searching i have used following search query:

```
         QueryStringQueryBuilder querystring = new

```

QueryStringQueryBuilder(searchData);  
SearchResponse searchResponse =  
client.prepareSearch(indexName).setTypes(indexType).setSearchType(SearchType.DEFAULT)  
.setQuery(querystring.field("Description")).setExplain(true).setSize(100).execute().actionGet();

Thanks

On Feb 5, 4:30 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> If the search analyzer is configured with the same elision filter, then it will be applied when searching as well, but only on queries that do analysis on the search text (query\_string, text, field). Which query did you execute?
> 
> On Friday, February 3, 2012 at 8:22 AM, sam wrote:
> 
> > Hi
> 
> > I have applied Elision Token Filter while indexing and searching,i  
> > created an index for “l’avion” and searched for "avion" and got the  
> > hits as “l’avion”.  
> > this is correct and i believe that analyzer are done correctly for  
> > Elision.  
> > but when i search for “l’avion” i got zero hits.i was expecting one  
> > hits.because i am searching the same which i indexed.
> 
> > why i couldn't get the hit? if i have misunderstood the concept then  
> > make it correct.
> 
> > used custom analyzer settings :
> 
> > {  
> > "index" : {  
> > "analysis" : {  
> > "analyzer" : {  
> > "manualindexanalyzer" : {  
> > "type":"custom",  
> > "tokenizer" : "whitespace",  
> > "filter" : ["lowercase","asciifolding","length","myelision"],  
> > "char\_filter" :["html\_strip"]  
> > },  
> > "manualsearchanalyzer" : {  
> > "type":"custom",  
> > "tokenizer" : "whitespace",  
> > "filter" : ["lowercase","asciifolding","length","myelision"],  
> > "char\_filter" :["html\_strip"]  
> > }  
> > },  
> > "filter" : {  
> > "myelision":{  
> > "type" : "elision",  
> > "articles" :["l", "m", "t", "qu", "n", "s", "j"]  
> > }  
> > }  
> > }  
> > }  
> > }
> 
> > Mapping :
> 
> > {  
> > "test\_type" : {  
> > "index\_analyzer" : "manualindexanalyzer",  
> > "search\_analyzer" : "manualsearchanalyzer"  
> > }  
> > }
> 
> > to put mapping i have used following java code:
> 
> > PutMappingResponse actionGet =  
> > client.admin().indices().preparePutMapping(indexName).setType(indexType).se tSource(analyzerMapping).execute().actionGet();  
> > boolean acknowledged = actionGet.getAcknowledged();  
> > logger.debug("put mapping acknowledged::" + acknowledged);
> 
> > Thanks

---

<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:** [February 7, 2012, 11:45am UTC](https://discuss.elastic.co/t/elision-token-filter-with-custom-analyzer/6581/4 "2012-02-07T11:45:09Z")

</div>

Here is a sample of where its working: [gist:1759303 · GitHub](https://gist.github.com/1759303).

On Tuesday, February 7, 2012 at 6:54 AM, sam wrote:

> Thanks for reply.
> 
> Mapping :  
> {  
> "test\_type" : {  
> "index\_analyzer" : "manualindexanalyzer",  
> "search\_analyzer" : "manualsearchanalyzer"  
> }  
> }
> 
> Here I have putting mapping to configured the index\_analyzer and  
> search\_analyzer,so it is not necessary to explicit define analyzer  
> when doing a search.  
> In my case which i pointed out in above question i have used  
> index\_analyzer and search\_analyzer both are same when index is  
> created.for searching i have used following search query:
> 
> QueryStringQueryBuilder querystring = new  
> QueryStringQueryBuilder(searchData);  
> SearchResponse searchResponse =  
> client.prepareSearch(indexName).setTypes(indexType).setSearchType(SearchType.DEFAULT)  
> .setQuery(querystring.field("Description")).setExplain(true).setSize(100).execute().actionGet();
> 
> Thanks
> 
> On Feb 5, 4:30 pm, Shay Banon \<[kim...@gmail.com](mailto:kim...@gmail.com) ([http://gmail.com](http://gmail.com))\> wrote:
> 
> > If the search analyzer is configured with the same elision filter, then it will be applied when searching as well, but only on queries that do analysis on the search text (query\_string, text, field). Which query did you execute?
> > 
> > On Friday, February 3, 2012 at 8:22 AM, sam wrote:
> > 
> > > Hi
> > 
> > > I have applied Elision Token Filter while indexing and searching,i  
> > > created an index for “l’avion” and searched for "avion" and got the  
> > > hits as “l’avion”.  
> > > this is correct and i believe that analyzer are done correctly for  
> > > Elision.  
> > > but when i search for “l’avion” i got zero hits.i was expecting one  
> > > hits.because i am searching the same which i indexed.
> > 
> > > why i couldn't get the hit? if i have misunderstood the concept then  
> > > make it correct.
> > 
> > > used custom analyzer settings :
> > 
> > > {  
> > > "index" : {  
> > > "analysis" : {  
> > > "analyzer" : {  
> > > "manualindexanalyzer" : {  
> > > "type":"custom",  
> > > "tokenizer" : "whitespace",  
> > > "filter" : ["lowercase","asciifolding","length","myelision"],  
> > > "char\_filter" :["html\_strip"]  
> > > },  
> > > "manualsearchanalyzer" : {  
> > > "type":"custom",  
> > > "tokenizer" : "whitespace",  
> > > "filter" : ["lowercase","asciifolding","length","myelision"],  
> > > "char\_filter" :["html\_strip"]  
> > > }  
> > > },  
> > > "filter" : {  
> > > "myelision":{  
> > > "type" : "elision",  
> > > "articles" :["l", "m", "t", "qu", "n", "s", "j"]  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }
> > 
> > > Mapping :
> > 
> > > {  
> > > "test\_type" : {  
> > > "index\_analyzer" : "manualindexanalyzer",  
> > > "search\_analyzer" : "manualsearchanalyzer"  
> > > }  
> > > }
> > 
> > > to put mapping i have used following java code:
> > 
> > > PutMappingResponse actionGet =  
> > > client.admin().indices().preparePutMapping(indexName).setType(indexType).se tSource(analyzerMapping).execute().actionGet();  
> > > boolean acknowledged = actionGet.getAcknowledged();  
> > > logger.debug("put mapping acknowledged::" + acknowledged);
> > 
> > > Thanks

---

<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:** [February 9, 2012, 5:43am UTC](https://discuss.elastic.co/t/elision-token-filter-with-custom-analyzer/6581/5 "2012-02-09T05:43:15Z")

</div>

Thanks for reply.yes it's working. I figured out the problem, i added  
logical analyzer name for searching, below is the used code:

QueryStringQueryBuilder querystring = new  
QueryStringQueryBuilder(searchData).analyzer("manualsearchanalyzer");  
SearchResponse searchResponse =  
client.prepareSearch(indexName).setTypes(indexType).setSearchType(SearchTyp  
e.DEFAULT)  
.setQuery(querystring.field("Description")).setExplain(true).setSize(100).e  
xecute().actionGet();

and previoulsy i was not giving analyzer name for searching.

I have read following document [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/root-object-type.html)  
that say that defining the mapping there is no need to define  
explicit mapping for both cases index and search, and I have applied  
this scheme. but my case it's working in indexing but not working on  
searching. I needed to explicitly define search analyzer when i  
searched for the given problem in this post i.e. I'avion .

What could be the reason that mapping is not applied for searching?

Thanks

On Feb 7, 4:45 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> Here is a sample of where its working:[gist:1759303 · GitHub](https://gist.github.com/1759303).
> 
> On Tuesday, February 7, 2012 at 6:54 AM, sam wrote:
> 
> > Thanks for reply.
> 
> > Mapping :  
> > {  
> > "test\_type" : {  
> > "index\_analyzer" : "manualindexanalyzer",  
> > "search\_analyzer" : "manualsearchanalyzer"  
> > }  
> > }
> 
> > Here I have putting mapping to configured the index\_analyzer and  
> > search\_analyzer,so it is not necessary to explicit define analyzer  
> > when doing a search.  
> > In my case which i pointed out in above question i have used  
> > index\_analyzer and search\_analyzer both are same when index is  
> > created.for searching i have used following search query:
> 
> > QueryStringQueryBuilder querystring = new  
> > QueryStringQueryBuilder(searchData);  
> > SearchResponse searchResponse =  
> > client.prepareSearch(indexName).setTypes(indexType).setSearchType(SearchTyp e.DEFAULT)  
> > .setQuery(querystring.field("Description")).setExplain(true).setSize(100).e xecute().actionGet();
> 
> > Thanks
> 
> > On Feb 5, 4:30 pm, Shay Banon \<[kim...@gmail.com](mailto:kim...@gmail.com) ([http://gmail.com](http://gmail.com))\> wrote:
> > 
> > > If the search analyzer is configured with the same elision filter, then it will be applied when searching as well, but only on queries that do analysis on the search text (query\_string, text, field). Which query did you execute?
> 
> > > On Friday, February 3, 2012 at 8:22 AM, sam wrote:
> > > 
> > > > Hi
> 
> > > > I have applied Elision Token Filter while indexing and searching,i  
> > > > created an index for “l’avion” and searched for "avion" and got the  
> > > > hits as “l’avion”.  
> > > > this is correct and i believe that analyzer are done correctly for  
> > > > Elision.  
> > > > but when i search for “l’avion” i got zero hits.i was expecting one  
> > > > hits.because i am searching the same which i indexed.
> 
> > > > why i couldn't get the hit? if i have misunderstood the concept then  
> > > > make it correct.
> 
> > > > used custom analyzer settings :
> 
> > > > {  
> > > > "index" : {  
> > > > "analysis" : {  
> > > > "analyzer" : {  
> > > > "manualindexanalyzer" : {  
> > > > "type":"custom",  
> > > > "tokenizer" : "whitespace",  
> > > > "filter" : ["lowercase","asciifolding","length","myelision"],  
> > > > "char\_filter" :["html\_strip"]  
> > > > },  
> > > > "manualsearchanalyzer" : {  
> > > > "type":"custom",  
> > > > "tokenizer" : "whitespace",  
> > > > "filter" : ["lowercase","asciifolding","length","myelision"],  
> > > > "char\_filter" :["html\_strip"]  
> > > > }  
> > > > },  
> > > > "filter" : {  
> > > > "myelision":{  
> > > > "type" : "elision",  
> > > > "articles" :["l", "m", "t", "qu", "n", "s", "j"]  
> > > > }  
> > > > }  
> > > > }  
> > > > }  
> > > > }
> 
> > > > Mapping :
> 
> > > > {  
> > > > "test\_type" : {  
> > > > "index\_analyzer" : "manualindexanalyzer",  
> > > > "search\_analyzer" : "manualsearchanalyzer"  
> > > > }  
> > > > }
> 
> > > > to put mapping i have used following java code:
> 
> > > > PutMappingResponse actionGet =  
> > > > client.admin().indices().preparePutMapping(indexName).setType(indexType).se tSource(analyzerMapping).execute().actionGet();  
> > > > boolean acknowledged = actionGet.getAcknowledged();  
> > > > logger.debug("put mapping acknowledged::" + acknowledged);
> 
> > > > Thanks

---

<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:** [February 9, 2012, 8:29am UTC](https://discuss.elastic.co/t/elision-token-filter-with-custom-analyzer/6581/6 "2012-02-09T08:29:21Z")

</div>

So now the code you posted is not the one you really used? This is annoying. If you want, I can answer the question you posted, but create a gist similar to what I created that exhibits what you expect, and I can have a look at it.

On Thursday, February 9, 2012 at 7:43 AM, sam wrote:

> Thanks for reply.yes it's working. I figured out the problem, i added  
> logical analyzer name for searching, below is the used code:
> 
> QueryStringQueryBuilder querystring = new  
> QueryStringQueryBuilder(searchData).analyzer("manualsearchanalyzer");  
> SearchResponse searchResponse =  
> client.prepareSearch(indexName).setTypes(indexType).setSearchType(SearchTyp  
> e.DEFAULT)  
> .setQuery(querystring.field("Description")).setExplain(true).setSize(100).e  
> xecute().actionGet();
> 
> and previoulsy i was not giving analyzer name for searching.
> 
> I have read following document [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/root-object-type.html)  
> that say that defining the mapping there is no need to define  
> explicit mapping for both cases index and search, and I have applied  
> this scheme. but my case it's working in indexing but not working on  
> searching. I needed to explicitly define search analyzer when i  
> searched for the given problem in this post i.e. I'avion .
> 
> What could be the reason that mapping is not applied for searching?
> 
> Thanks
> 
> On Feb 7, 4:45 pm, Shay Banon \<[kim...@gmail.com](mailto:kim...@gmail.com) ([http://gmail.com](http://gmail.com))\> wrote:
> 
> > Here is a sample of where its working:[gist:1759303 · GitHub](https://gist.github.com/1759303).
> > 
> > On Tuesday, February 7, 2012 at 6:54 AM, sam wrote:
> > 
> > > Thanks for reply.
> > 
> > > Mapping :  
> > > {  
> > > "test\_type" : {  
> > > "index\_analyzer" : "manualindexanalyzer",  
> > > "search\_analyzer" : "manualsearchanalyzer"  
> > > }  
> > > }
> > 
> > > Here I have putting mapping to configured the index\_analyzer and  
> > > search\_analyzer,so it is not necessary to explicit define analyzer  
> > > when doing a search.  
> > > In my case which i pointed out in above question i have used  
> > > index\_analyzer and search\_analyzer both are same when index is  
> > > created.for searching i have used following search query:
> > 
> > > QueryStringQueryBuilder querystring = new  
> > > QueryStringQueryBuilder(searchData);  
> > > SearchResponse searchResponse =  
> > > client.prepareSearch(indexName).setTypes(indexType).setSearchType(SearchTyp e.DEFAULT)  
> > > .setQuery(querystring.field("Description")).setExplain(true).setSize(100).e xecute().actionGet();
> > 
> > > Thanks
> > 
> > > On Feb 5, 4:30 pm, Shay Banon \<[kim...@gmail.com](mailto:kim...@gmail.com) ([http://gmail.com](http://gmail.com))\> wrote:
> > > 
> > > > If the search analyzer is configured with the same elision filter, then it will be applied when searching as well, but only on queries that do analysis on the search text (query\_string, text, field). Which query did you execute?
> > 
> > > > On Friday, February 3, 2012 at 8:22 AM, sam wrote:
> > > > 
> > > > > Hi
> > 
> > > > > I have applied Elision Token Filter while indexing and searching,i  
> > > > > created an index for “l’avion” and searched for "avion" and got the  
> > > > > hits as “l’avion”.  
> > > > > this is correct and i believe that analyzer are done correctly for  
> > > > > Elision.  
> > > > > but when i search for “l’avion” i got zero hits.i was expecting one  
> > > > > hits.because i am searching the same which i indexed.
> > 
> > > > > why i couldn't get the hit? if i have misunderstood the concept then  
> > > > > make it correct.
> > 
> > > > > used custom analyzer settings :
> > 
> > > > > {  
> > > > > "index" : {  
> > > > > "analysis" : {  
> > > > > "analyzer" : {  
> > > > > "manualindexanalyzer" : {  
> > > > > "type":"custom",  
> > > > > "tokenizer" : "whitespace",  
> > > > > "filter" : ["lowercase","asciifolding","length","myelision"],  
> > > > > "char\_filter" :["html\_strip"]  
> > > > > },  
> > > > > "manualsearchanalyzer" : {  
> > > > > "type":"custom",  
> > > > > "tokenizer" : "whitespace",  
> > > > > "filter" : ["lowercase","asciifolding","length","myelision"],  
> > > > > "char\_filter" :["html\_strip"]  
> > > > > }  
> > > > > },  
> > > > > "filter" : {  
> > > > > "myelision":{  
> > > > > "type" : "elision",  
> > > > > "articles" :["l", "m", "t", "qu", "n", "s", "j"]  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }
> > 
> > > > > Mapping :
> > 
> > > > > {  
> > > > > "test\_type" : {  
> > > > > "index\_analyzer" : "manualindexanalyzer",  
> > > > > "search\_analyzer" : "manualsearchanalyzer"  
> > > > > }  
> > > > > }
> > 
> > > > > to put mapping i have used following java code:
> > 
> > > > > PutMappingResponse actionGet =  
> > > > > client.admin().indices().preparePutMapping(indexName).setType(indexType).se tSource(analyzerMapping).execute().actionGet();  
> > > > > boolean acknowledged = actionGet.getAcknowledged();  
> > > > > logger.debug("put mapping acknowledged::" + acknowledged);
> > 
> > > > > Thanks

---

<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:** [February 16, 2012, 8:01am UTC](https://discuss.elastic.co/t/elision-token-filter-with-custom-analyzer/6581/7 "2012-02-16T08:01:59Z")

</div>

sorry for inconvenient.i figured out the problem, i added logical  
analyzer name for searching,i have following gist :

> <https://gist.github.com/sameek/1843065>

and previoulsy i was not giving analyzer name for searching.  
I have read following document [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/root-object-type)...  
that say that defining the mapping there is no need to define  
explicit mapping for both cases index and search, and I have applied  
this scheme. but my case it's working in indexing but not working on  
searching. I needed to explicitly define search analyzer when i  
searched for the given problem in this post i.e. I'avion .  
What could be the reason that mapping is not applied for searching?

Thanks

On Feb 9, 1:29 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> So now the code you posted is not the one you really used? This is annoying. If you want, I can answer the question you posted, but create a gist similar to what I created that exhibits what you expect, and I can have a look at it.
> 
> On Thursday, February 9, 2012 at 7:43 AM, sam wrote:
> 
> > Thanks for reply.yes it's working. I figured out the problem, i added  
> > logical analyzer name for searching, below is the used code:
> 
> > QueryStringQueryBuilder querystring = new  
> > QueryStringQueryBuilder(searchData).analyzer("manualsearchanalyzer");  
> > SearchResponse searchResponse =  
> > client.prepareSearch(indexName).setTypes(indexType).setSearchType(SearchTyp  
> > e.DEFAULT)  
> > .setQuery(querystring.field("Description")).setExplain(true).setSize(100).e  
> > xecute().actionGet();
> 
> > and previoulsy i was not giving analyzer name for searching.
> 
> > I have read following documenthttp://www.elasticsearch.org/guide/reference/mapping/root-object-type...  
> > that say that defining the mapping there is no need to define  
> > explicit mapping for both cases index and search, and I have applied  
> > this scheme. but my case it's working in indexing but not working on  
> > searching. I needed to explicitly define search analyzer when i  
> > searched for the given problem in this post i.e. I'avion .
> 
> > What could be the reason that mapping is not applied for searching?
> 
> > Thanks
> 
> > On Feb 7, 4:45 pm, Shay Banon \<[kim...@gmail.com](mailto:kim...@gmail.com) ([http://gmail.com](http://gmail.com))\> wrote:
> > 
> > > Here is a sample of where its working:[gist:1759303 · GitHub](https://gist.github.com/1759303).
> 
> > > On Tuesday, February 7, 2012 at 6:54 AM, sam wrote:
> > > 
> > > > Thanks for reply.
> 
> > > > Mapping :  
> > > > {  
> > > > "test\_type" : {  
> > > > "index\_analyzer" : "manualindexanalyzer",  
> > > > "search\_analyzer" : "manualsearchanalyzer"  
> > > > }  
> > > > }
> 
> > > > Here I have putting mapping to configured the index\_analyzer and  
> > > > search\_analyzer,so it is not necessary to explicit define analyzer  
> > > > when doing a search.  
> > > > In my case which i pointed out in above question i have used  
> > > > index\_analyzer and search\_analyzer both are same when index is  
> > > > created.for searching i have used following search query:
> 
> > > > QueryStringQueryBuilder querystring = new  
> > > > QueryStringQueryBuilder(searchData);  
> > > > SearchResponse searchResponse =  
> > > > client.prepareSearch(indexName).setTypes(indexType).setSearchType(SearchTyp e.DEFAULT)  
> > > > .setQuery(querystring.field("Description")).setExplain(true).setSize(100).e xecute().actionGet();
> 
> > > > Thanks
> 
> > > > On Feb 5, 4:30 pm, Shay Banon \<[kim...@gmail.com](mailto:kim...@gmail.com) ([http://gmail.com](http://gmail.com))\> wrote:
> > > > 
> > > > > If the search analyzer is configured with the same elision filter, then it will be applied when searching as well, but only on queries that do analysis on the search text (query\_string, text, field). Which query did you execute?
> 
> > > > > On Friday, February 3, 2012 at 8:22 AM, sam wrote:
> > > > > 
> > > > > > Hi
> 
> > > > > > I have applied Elision Token Filter while indexing and searching,i  
> > > > > > created an index for “l’avion” and searched for "avion" and got the  
> > > > > > hits as “l’avion”.  
> > > > > > this is correct and i believe that analyzer are done correctly for  
> > > > > > Elision.  
> > > > > > but when i search for “l’avion” i got zero hits.i was expecting one  
> > > > > > hits.because i am searching the same which i indexed.
> 
> > > > > > why i couldn't get the hit? if i have misunderstood the concept then  
> > > > > > make it correct.
> 
> > > > > > used custom analyzer settings :
> 
> > > > > > {  
> > > > > > "index" : {  
> > > > > > "analysis" : {  
> > > > > > "analyzer" : {  
> > > > > > "manualindexanalyzer" : {  
> > > > > > "type":"custom",  
> > > > > > "tokenizer" : "whitespace",  
> > > > > > "filter" : ["lowercase","asciifolding","length","myelision"],  
> > > > > > "char\_filter" :["html\_strip"]  
> > > > > > },  
> > > > > > "manualsearchanalyzer" : {  
> > > > > > "type":"custom",  
> > > > > > "tokenizer" : "whitespace",  
> > > > > > "filter" : ["lowercase","asciifolding","length","myelision"],  
> > > > > > "char\_filter" :["html\_strip"]  
> > > > > > }  
> > > > > > },  
> > > > > > "filter" : {  
> > > > > > "myelision":{  
> > > > > > "type" : "elision",  
> > > > > > "articles" :["l", "m", "t", "qu", "n", "s", "j"]  
> > > > > > }  
> > > > > > }  
> > > > > > }  
> > > > > > }  
> > > > > > }
> 
> > > > > > Mapping :
> 
> > > > > > {  
> > > > > > "test\_type" : {  
> > > > > > "index\_analyzer" : "manualindexanalyzer",  
> > > > > > "search\_analyzer" : "manualsearchanalyzer"  
> > > > > > }  
> > > > > > }
> 
> > > > > > to put mapping i have used following java code:
> 
> > > > > > PutMappingResponse actionGet =  
> > > > > > client.admin().indices().preparePutMapping(indexName).setType(indexType).se tSource(analyzerMapping).execute().actionGet();  
> > > > > > boolean acknowledged = actionGet.getAcknowledged();  
> > > > > > logger.debug("put mapping acknowledged::" + acknowledged);
> 
> > > > > > Thanks

---

<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:39am UTC](https://discuss.elastic.co/t/elision-token-filter-with-custom-analyzer/6581/8 "2017-07-06T03:39:08Z")

</div>


