# How to defines both the index\_analyzer and search\_analyzer explicitly?

**URL:** <https://discuss.elastic.co/t/how-to-defines-both-the-index-analyzer-and-search-analyzer-explicitly/6426>\
**Category:** Elasticsearch\
**Created:** [January 18, 2012, 9:10am UTC](https://discuss.elastic.co/t/how-to-defines-both-the-index-analyzer-and-search-analyzer-explicitly/6426 "2012-01-18T09:10:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shammi\_mishra](https://avatars.discourse-cdn.com/v4/letter/s/ee7513/32.png) [@shammi\_mishra](https://discuss.elastic.co/u/shammi_mishra)\
**Post date:** [January 18, 2012, 9:10am UTC](https://discuss.elastic.co/t/how-to-defines-both-the-index-analyzer-and-search-analyzer-explicitly/6426/1 "2012-01-18T09:10:22Z")

</div>

Hi

I want to define both the index\_analyzer and search\_analyzer  
explicitly using mapping. i have read following documents

Index / Search Analyzers  
[http://www.elasticsearch.org/guide/reference/mapping/root-object-type.html](http://www.elasticsearch.org/guide/reference/mapping/root-object-type.html)

Analyzer  
[http://www.elasticsearch.org/guide/reference/index-modules/analysis/](http://www.elasticsearch.org/guide/reference/index-modules/analysis/)

Core Types  
[http://www.elasticsearch.org/guide/reference/mapping/core-types.html](http://www.elasticsearch.org/guide/reference/mapping/core-types.html)

for reading this document,i am confuse for explicitly defining both.  
after some Google i found following link :

> <https://gist.github.com/vshkurin/1109136>

after that i have try following mapping:

{  
"settings":{  
"analysis": {  
"analyzer":  
{  
"index\_analyzer": {  
"name":"default",  
"type" :"custom",  
"tokenizer": "whitespace",  
"filter": ["lowercase", "customstopfilter", "asciifolding"]  
},  
"search\_analyzer": {  
"name":"default",  
"type" :"custom",  
"tokenizer": "whitespace" ,  
"filter": ["lowercase", "customstopfilter", "asciifolding"]  
}  
},  
{  
"filter":{  
"customstopfilter":  
{  
"type":"stop" ,  
"stopwords\_path" :"F:\resources\stopwords\_eng.txt" ,  
"ignore\_case":true  
}  
}  
}  
}  
}  
}

but again i failed to configured it,please help me.

Thanks

---

<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:** [January 18, 2012, 1:11pm UTC](https://discuss.elastic.co/t/how-to-defines-both-the-index-analyzer-and-search-analyzer-explicitly/6426/2 "2012-01-18T13:11:40Z")

</div>

try to search the mailing list before 🙂

[http://groups.google.com/group/elasticsearch/browse\_thread/thread/2c3082a47d10ba41/328970161fdc66a0?lnk=gst&q=custom+analyzer#328970161fdc66a0](http://groups.google.com/group/elasticsearch/browse_thread/thread/2c3082a47d10ba41/328970161fdc66a0?lnk=gst&q=custom+analyzer#328970161fdc66a0)

Peter.

On 18 Jan., 10:10, shammi mishra [mishrashamm...@gmail.com](mailto:mishrashamm...@gmail.com) wrote:

> Hi
> 
> I want to define both the index\_analyzer and search\_analyzer  
> explicitly using mapping. i have read following documents
> 
> Index / Search Analyzershttp://www.elasticsearch.org/guide/reference/mapping/root-object-type...
> 
> Analyzerhttp://www.elasticsearch.org/guide/reference/index-modules/analysis/
> 
> Core Typeshttp://www.elasticsearch.org/guide/reference/mapping/core-types.html
> 
> for reading this document,i am confuse for explicitly defining both.  
> after some Google i found following link :[ElasticSearch Test Queries · GitHub](https://gist.github.com/1109136)
> 
> after that i have try following mapping:
> 
> {  
> "settings":{  
> "analysis": {  
> "analyzer":  
> {  
> "index\_analyzer": {  
> "name":"default",  
> "type" :"custom",  
> "tokenizer": "whitespace",  
> "filter": ["lowercase", "customstopfilter", "asciifolding"]  
> },  
> "search\_analyzer": {  
> "name":"default",  
> "type" :"custom",  
> "tokenizer": "whitespace" ,  
> "filter": ["lowercase", "customstopfilter", "asciifolding"]  
> }  
> },  
> {  
> "filter":{  
> "customstopfilter":  
> {  
> "type":"stop" ,  
> "stopwords\_path" :"F:\resources\stopwords\_eng.txt" ,  
> "ignore\_case":true  
> }  
> }  
> }  
> }  
> }
> 
> }
> 
> but again i failed to configured it,please help me.
> 
> Thanks

---

<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:** [January 18, 2012, 1:12pm UTC](https://discuss.elastic.co/t/how-to-defines-both-the-index-analyzer-and-search-analyzer-explicitly/6426/3 "2012-01-18T13:12:40Z")

</div>

I mean use java api or elasticsearch.yml/json like here:

> <https://github.com/karussell/Jetwick/blob/master/es/config/elasticsearch.json>

On 18 Jan., 14:11, Karussell [tableyourt...@googlemail.com](mailto:tableyourt...@googlemail.com) wrote:

> try to search the mailing list before 🙂
> 
> [http://groups.google.com/group/elasticsearch/browse\_thread/thread/2c3](http://groups.google.com/group/elasticsearch/browse_thread/thread/2c3)...
> 
> Peter.
> 
> On 18 Jan., 10:10, shammi mishra [mishrashamm...@gmail.com](mailto:mishrashamm...@gmail.com) wrote:
> 
> > Hi
> 
> > I want to define both the index\_analyzer and search\_analyzer  
> > explicitly using mapping. i have read following documents
> 
> > Index / Search Analyzershttp://www.elasticsearch.org/guide/reference/mapping/root-object-type...
> 
> > Analyzerhttp://www.elasticsearch.org/guide/reference/index-modules/analysis/
> 
> > Core Typeshttp://www.elasticsearch.org/guide/reference/mapping/core-types.html
> 
> > for reading this document,i am confuse for explicitly defining both.  
> > after some Google i found following link :[ElasticSearch Test Queries · GitHub](https://gist.github.com/1109136)
> 
> > after that i have try following mapping:
> 
> > {  
> > "settings":{  
> > "analysis": {  
> > "analyzer":  
> > {  
> > "index\_analyzer": {  
> > "name":"default",  
> > "type" :"custom",  
> > "tokenizer": "whitespace",  
> > "filter": ["lowercase", "customstopfilter", "asciifolding"]  
> > },  
> > "search\_analyzer": {  
> > "name":"default",  
> > "type" :"custom",  
> > "tokenizer": "whitespace" ,  
> > "filter": ["lowercase", "customstopfilter", "asciifolding"]  
> > }  
> > },  
> > {  
> > "filter":{  
> > "customstopfilter":  
> > {  
> > "type":"stop" ,  
> > "stopwords\_path" :"F:\resources\stopwords\_eng.txt" ,  
> > "ignore\_case":true  
> > }  
> > }  
> > }  
> > }  
> > }
> 
> > }
> 
> > but again i failed to configured it,please help me.
> 
> > 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:42am UTC](https://discuss.elastic.co/t/how-to-defines-both-the-index-analyzer-and-search-analyzer-explicitly/6426/4 "2017-07-06T03:42:21Z")

</div>


