# How to add Multiple analyzers to a field

**URL:** <https://discuss.elastic.co/t/how-to-add-multiple-analyzers-to-a-field/155938>\
**Category:** Elasticsearch\
**Created:** [November 8, 2018, 5:04pm UTC](https://discuss.elastic.co/t/how-to-add-multiple-analyzers-to-a-field/155938 "2018-11-08T17:04:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anveshdd](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@anveshdd](https://discuss.elastic.co/u/anveshdd)\
**Post date:** [November 8, 2018, 5:04pm UTC](https://discuss.elastic.co/t/how-to-add-multiple-analyzers-to-a-field/155938/1 "2018-11-08T17:04:01Z")

</div>

I am working on ES 6.4.2, want to apply multiple analyzers to a field. I am looking to apply snowball and stop word. I tried thie below mapping is this the correct apporach.

```auto
PUT /some-index
{
    "settings": {
        "index": {
            "number_of_shards": 5,
            "number_of_replicas": 1,
            "refresh_interval": "60s",
            "analysis" : {
              "analyzer" : {
                "my_analyzer" : {
                    "tokenizer" : "standard",
                    "filter" : ["standard", "lowercase", "my_snow"]
               },
               "stop_analyzer": {
                 "type": "stop",
                 "stopwords": "_english_"
               }
              } ,

              "filter" : {
                "my_snow" : {
                    "type" : "snowball",
                    "language" : "Lovins"
                }
            }
        }
        }
    },
    "mappings": {
        "doc": {
            "_source": {
                "enabled": true
            },
            "properties": {
                "content": {
                    "type": "text",
                    "index": "true",
                    "store": true,
                     "analyzer":["my_analyzer","stop_analyzer"],
                     "search_analyzer": "my_analyzer"
                },

                "title": {
                    "type": "text",
                    "index": "true",
                    "store": true,
                            "analyzer":["my_analyzer","stop_analyzer"],
                            "search_analyzer": "my_analyzer"

                }
            }
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 9, 2018, 11:06am UTC](https://discuss.elastic.co/t/how-to-add-multiple-analyzers-to-a-field/155938/2 "2018-11-09T11:06:49Z")

</div>

you may want to check out [multi fields](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/multi-fields.html)

--Alex

---

<div class="post-metadata">

**Author:** ![Jasmeet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasmeet/32/69393_2.png) [@Jasmeet](https://discuss.elastic.co/u/Jasmeet)\
**Post date:** [November 9, 2018, 5:32pm UTC](https://discuss.elastic.co/t/how-to-add-multiple-analyzers-to-a-field/155938/3 "2018-11-09T17:32:52Z")

</div>

You could change the dbl\_metaphone and shingle analysers  
indent preformatted text by 4 spaces  
{  
"settings": {  
"index.mapping.total\_fields.limit": 2000,  
"analysis": {  
"analyzer": {  
"default": {  
"type": "custom",  
"tokenizer": "standard",  
"filter": ["lowercase","custom\_edge\_ngram"]  
},  
"dbl\_metaphone":{  
"type": "custom",  
"tokenizer": "standard",  
"filter": ["dbl\_metaphone"]  
},   
"shingle":{  
"type": "custom",  
"tokenizer": "standard",  
"filter": ["shingle-filter"]  
}   
},  
"filter": {  
"custom\_edge\_ngram": {  
"type": "edge\_ngram",  
"min\_gram": 2,  
"max\_gram": 10  
},  
"dbl\_metaphone": {  
"type": "phonetic",  
"encoder": "double\_metaphone"  
},   
"shingle-filter": {  
"max\_shingle\_size": "5",  
"min\_shingle\_size": "2",  
"output\_unigrams": "false",  
"type": "shingle"  
}  
}}}},

"mappings": {  
"\_doc": {  
--------------------------  
"content": {  
"type": "text"  
"index\_analyzer": "default",  
"search\_analyzer" : "standard",  
"fields:{  
"phonetic":{  
"type":"text",  
"analyzer":"dbl\_metaphone"  
},  
"shingle":{  
"type":"text",  
"analyzer":"shingle"  
}  
}  
},  
indent preformatted text by 4 spaces

---

<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:** [December 7, 2018, 5:33pm UTC](https://discuss.elastic.co/t/how-to-add-multiple-analyzers-to-a-field/155938/4 "2018-12-07T17:33:04Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
