I have defined my own template to be used by logstash where I have deactivate the dynamic mapping:
{
	"my_index": {
		"order": 0,
		"template": "my_index",
		"settings": {
			"index": {
				"mapper": {
					"dynamic": "false"
				},
				"analysis": {
					"analyzer": {
						"nlp_analyzer": {
							"filter": [
								"lowercase"
							],
							"type": "custom",
							"tokenizer": "nlp_tokenizer"
						}
					},
					"tokenizer": {
						"nlp_tokenizer": {
							"pattern": ""
							"(\w+)|(\s*[\s+])"
							"",
							"type": "pattern"
						}
					}
				},
				"number_of_shards": "1",
				"number_of_replicas": "0"
			}
		},
		"mappings": {
			"author": {
				"properties": {
					"author_name": {
						"type": "keyword"
					},
					"author_pseudo": {
						"type": "keyword"
					},
					"author_location": {
						"type": "text",
						"fields": {
							"standard": {
								"analyzer": "standard",
								"term_vector": "yes",
								"type": "text"
							},
							"nlp": {
								"analyzer": "nlp_analyzer",
								"term_vector": "yes",
								"type": "text"
							}
						}
					}
				}
			}
		}
	}
}
To test if elasticsearch won't generate new field I try to let a field in my events that is not present in my mapping, let's say that I have this event:
{
"type" => "author",
"author_pseudo" => "chloemdelorenzo",
"author_name" => "Chloe DeLorenzo",
"author_location" => "US",
}
Elasticsearch will generate a new fielding the mapping when indexing this event:
"type": {
     "type": "text",
      "fields": {
           "keyword": {
                "type": "keyword",
                "ignore_above": 256
           }
      }
 }
I know that Logstash is using my template because in my mapping I use a custom analyser and I can find it back into the mapping generated. But apparently it doesn't take into consideration that the dynamic field is disabled.
I want elastic search to ignore fields that are not present in my mapping but to index the field that have a defined mapping. How can I avoid logstash to create new field?