Elastic search 2.3.4 MapperParsingException with analyzer

When upgrading from ES 1.0.2 to ES 2.3.4, we had to remove the - ImmutableSettings.classLoader() api, so used mockNode extending Node class to add plugins for client node as suggested in Add plugins from classpath in embedded Elasticsearch client node.

When started Elasticsearch node, got below log, which says my_analyzer is loaded.
INFO: modules [], plugins [my_analyzer, delete-by-query], sites []
But when creating index with analyzer set to my_analyzer, got below error

Caused by: MapperParsingException[Root mapping definition has unsupported parameters: [analyzer : my_analyzer]]
at org.elasticsearch.index.mapper.DocumentMapperParser.checkNoRemainingFields(DocumentMapperParser.java:171)
at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:159)
at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:99)
at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:508)
at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:288)
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$1.execute(MetaDataCreateIndexService.java:329)
... 8 more

Does this mean the analyzer plugin is not identified properly?

Apparently your plugin is correctly loaded.
But you are may be nor registering the analyzer correctly?

You could look at https://github.com/elastic/elasticsearch/tree/2.4/plugins/analysis-kuromoji for inspiration.

See https://github.com/elastic/elasticsearch/blob/2.4/plugins/analysis-kuromoji/src/main/java/org/elasticsearch/plugin/analysis/kuromoji/AnalysisKuromojiPlugin.java#L60

Even after registering the analyzer using AnalysisModule.addAnalyzer and AnalysisModule.addProcessor, still getting the same error. I am not able to figure out the root cause yet.

Debugging further, i have seen entries in analyzers in AnalysizModule object

How do you create the index/mapping?

Using the java api-

client.admin().indices().prepareCreate(name)
			  .setSettings(createIndexSetting()) // // define settings
			 .addMapping("typeName", createIndexMapping()) // // define mappings
			 .execute().actionGet();

Index Mappings look like

{
"typeName" {
    "analyzer" : "my_analyzer",
     "_source" { enabled : "false"},
    "properties" : {
        ----------
     }
}
}

I edited your post with </> icon to format it a bit better. (Still ugly though)

I don't think you can define an analyzer for the whole type like this.
You have to define analyzer per field or use dynamic templates.

Can you try without this "top level" analyzer?

Top level analyzer for whole type used to work in 1.0.2. Has something changed in 2.3.4?

When moved the analyzer from mappings to settings, index is created with my_analyzer

"settings": {
"index": {
"creation_date": "1469162969623"
"number_of_replicas": "0"
"date_detection": "false"
"numeric_detection": "false"
"analyzer": "my_analyzer"
"uuid": "sauh7Tx1QpuYkZBayERR6g"
"number_of_shards": "1"
"refresh_interval": "5s"
"version": {
"created": "2030499"
}-
}-
}