Tom
Tom

Reputation: 4161

Elasticsearch set default field analyzer for index

I was wondering if it is possible to modify the behviour of ES when dynamically mapping a field. In my case I don't want ES to map anything. Most of the fields I have are considered text by ES when the field occurs for the first time.

The correct mapping though for our application is 99% always keyword since we don't want the tokenizer to run on it. Can we modify the behaviour for new fields to be always mapped as keyword (unless defined otherwise in the index mapping of course)

Cheers and thanks!

Upvotes: 0

Views: 261

Answers (1)

Alexey Prudnikov
Alexey Prudnikov

Reputation: 1123

You can use dynamic templates to solve your issue. Moreover, Elasticsearch guide has snippet which is suitable for your case.

Upvotes: 1

Related Questions