# Dynamic mapping for string analyzer?

**URL:** <https://discuss.elastic.co/t/dynamic-mapping-for-string-analyzer/6210>\
**Category:** Elasticsearch\
**Created:** [December 21, 2011, 2:20pm UTC](https://discuss.elastic.co/t/dynamic-mapping-for-string-analyzer/6210 "2011-12-21T14:20:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrej](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@Andrej](https://discuss.elastic.co/u/Andrej)\
**Post date:** [December 21, 2011, 2:20pm UTC](https://discuss.elastic.co/t/dynamic-mapping-for-string-analyzer/6210/1 "2011-12-21T14:20:51Z")

</div>

Hi,

mybe I've overseen it; I am looking for an elegant way to write a  
mapping for a document type where I can get rid of stopwords for all  
strings. Setting something like "analyzer" : { "type" : "standard",  
"stopwords" : "_none_" } for a property works fine, but how can I set  
this as default for all properties of type string? Is there a way to  
do so using either _default_ or maybe dynamic\_templates? I am a bit  
puzzled about the syntax here. So if anyone could help with a little  
code snippet, I would really appreciate this!

Thanks!  
Andrej

---

<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:** [December 22, 2011, 12:58am UTC](https://discuss.elastic.co/t/dynamic-mapping-for-string-analyzer/6210/2 "2011-12-22T00:58:15Z")

</div>

You have two options:

1. Name your analyzer "default", and have it the same as the standard  
analyzer (standard tokenizer, standard and lowercase, without stop). This  
will then be used for all string type fields.

2. Use index templates to create a _default_ mapping, with a dynamic  
mapping that set the analyzer to the one you configured based on match\_type  
of string. (  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/root-object-type.htmlat)  
the bottom explains dynamic templates for specific type mapping, in  
your  
case, the type is _default_).

I think 1 will be simplest.

On Wed, Dec 21, 2011 at 4:20 PM, Andrej Rosenheinrich \<  
[andrej.rosenheinrich@unister.de](mailto:andrej.rosenheinrich@unister.de)\> wrote:

> Hi,
> 
> mybe I've overseen it; I am looking for an elegant way to write a  
> mapping for a document type where I can get rid of stopwords for all  
> strings. Setting something like "analyzer" : { "type" : "standard",  
> "stopwords" : "_none_" } for a property works fine, but how can I set  
> this as default for all properties of type string? Is there a way to  
> do so using either _default_ or maybe dynamic\_templates? I am a bit  
> puzzled about the syntax here. So if anyone could help with a little  
> code snippet, I would really appreciate this!
> 
> Thanks!  
> Andrej

---

<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:44am UTC](https://discuss.elastic.co/t/dynamic-mapping-for-string-analyzer/6210/3 "2017-07-06T03:44:38Z")

</div>

Closed on July 6, 2017, 3:44am UTC


