Dynamic mapping for string analyzer?

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

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
    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> 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