How to limit the list of fields that can be written to a specific index?

I want my document index to contain only fields ('a', 'b', 'c' for example). How can I do this?

configure your mapping for these three fields and set the dynamic parameter in the mapping to strict. See

Thank you so much!

I took an example of creating an index from your link but got this error : java.lang.Boolean cannot be cast to java.util.Map

please do not use screenshots, but use markdown to properly format code snippets, so other people can copy & paste them for testing.

Also add the version of Elasticsearch you are using.


can you try specifying a type like _doc in the mapping? Also, if you provide the code as a snippet, people will be able to reproduce locally by copy & paste. Noone will type your code sample from your image though.