Search code examples
elasticsearchelasticsearch-mapping

How to set default mapping to "keyword" for dynamically added properties in Elasticsearch


In our application we add new documents which can have new unknown properties.

Is it possible to set default mapping to "keyword" for dynamically added new properties in Elasticsearch?


Solution

  • Dynamic template doc has an example for type string. Also in case you don't already use index templates read the relevant doc as the dynamic template can be specify with CREATE INDEX API but more commonly in the index template