# Adding custom analyzer after index creation

**URL:** <https://discuss.elastic.co/t/adding-custom-analyzer-after-index-creation/9764>\
**Category:** Elasticsearch\
**Created:** [November 19, 2012, 10:28pm UTC](https://discuss.elastic.co/t/adding-custom-analyzer-after-index-creation/9764 "2012-11-19T22:28:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Todd\_Gruben](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@Todd\_Gruben](https://discuss.elastic.co/u/Todd_Gruben)\
**Post date:** [November 19, 2012, 10:28pm UTC](https://discuss.elastic.co/t/adding-custom-analyzer-after-index-creation/9764/1 "2012-11-19T22:28:13Z")

</div>

I would like to add a new type mapping to an existing index that needs to  
have a custom analyzer (ngram\_analyzer) described below.

{  
"index" : {  
"analysis" : {  
"analyzer" : {  
"ngram\_analyzer" : {  
"type" : "custom",  
"tokenizer" : "lowercase",  
"filter" : ["ngram\_filter"]  
}  
},  
"filter" : {  
"ngram\_filter" : {  
"type" : "nGram",  
"min\_gram" : 3,  
"max\_gram" : 8  
}  
}  
}  
}

I am trying to post to the setting url, but  
[http://localhost:9200/existing\_index/\_settings](http://localhost:9200/existing_index/_settings) , but when i trying to add  
the new mapping it gives me an error saying that ngram\_analyzer does not  
exists. the curl post returns "OK". but i think I am missing something.  
Any one have a quick curl gist example on how this would work?

-Todd

--

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 19, 2012, 10:39pm UTC](https://discuss.elastic.co/t/adding-custom-analyzer-after-index-creation/9764/2 "2012-11-19T22:39:23Z")

</div>

Here is a gist on how to create analyzer and use it in mapping: [https://gist.github.com/2146038](https://gist.github.com/2146038)

## Does it help?

David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 19 nov. 2012 à 23:28, Todd Gruben [tgruben@gmail.com](mailto:tgruben@gmail.com) a écrit :

I would like to add a new type mapping to an existing index that needs to have a custom analyzer (ngram\_analyzer) described below.

{  
"index" : {  
"analysis" : {  
"analyzer" : {  
"ngram\_analyzer" : {  
"type" : "custom",  
"tokenizer" : "lowercase",  
"filter" : ["ngram\_filter"]  
}  
},  
"filter" : {  
"ngram\_filter" : {  
"type" : "nGram",  
"min\_gram" : 3,  
"max\_gram" : 8  
}  
}  
}  
}

I am trying to post to the setting url, but [http://localhost:9200/existing\_index/\_settings](http://localhost:9200/existing_index/_settings) , but when i trying to add the new mapping it gives me an error saying that ngram\_analyzer does not exists. the curl post returns "OK". but i think I am missing something. Any one have a quick curl gist example on how this would work?

-Todd

--

--

---

<div class="post-metadata">

**Author:** ![Todd\_Gruben](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@Todd\_Gruben](https://discuss.elastic.co/u/Todd_Gruben)\
**Post date:** [November 20, 2012, 6:42pm UTC](https://discuss.elastic.co/t/adding-custom-analyzer-after-index-creation/9764/3 "2012-11-20T18:42:02Z")

</div>

that gist is setting up the custom analyzer at the time of index creation,  
what I would like to do is do it when i create the mapping. I have just  
opted to create a new index and all works ok.

-Todd

On Monday, November 19, 2012 4:39:31 PM UTC-6, David Pilato wrote:

> Here is a gist on how to create analyzer and use it in mapping:  
> [French analyzer for ES · GitHub](https://gist.github.com/2146038)
> 
> ## Does it help?
> 
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 19 nov. 2012 à 23:28, Todd Gruben \<[tgr...@gmail.com](mailto:tgr...@gmail.com) \<javascript:\>\> a  
> écrit :
> 
> I would like to add a new type mapping to an existing index that needs to  
> have a custom analyzer (ngram\_analyzer) described below.
> 
> {  
> "index" : {  
> "analysis" : {  
> "analyzer" : {  
> "ngram\_analyzer" : {  
> "type" : "custom",  
> "tokenizer" : "lowercase",  
> "filter" : ["ngram\_filter"]  
> }  
> },  
> "filter" : {  
> "ngram\_filter" : {  
> "type" : "nGram",  
> "min\_gram" : 3,  
> "max\_gram" : 8  
> }  
> }  
> }  
> }
> 
> I am trying to post to the setting url, but  
> [http://localhost:9200/existing\_index/\_settings](http://localhost:9200/existing_index/_settings) , but when i trying to add  
> the new mapping it gives me an error saying that ngram\_analyzer does not  
> exists. the curl post returns "OK". but i think I am missing something.  
> Any one have a quick curl gist example on how this would work?
> 
> -Todd
> 
> --

--

---

<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:03am UTC](https://discuss.elastic.co/t/adding-custom-analyzer-after-index-creation/9764/4 "2017-07-06T03:03:28Z")

</div>


