# Elastic search 2.3.4 MapperParsingException with analyzer

**URL:** <https://discuss.elastic.co/t/elastic-search-2-3-4-mapperparsingexception-with-analyzer/56085>\
**Category:** Elasticsearch\
**Created:** [July 21, 2016, 10:28am UTC](https://discuss.elastic.co/t/elastic-search-2-3-4-mapperparsingexception-with-analyzer/56085 "2016-07-21T10:28:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![SwethaS](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@SwethaS](https://discuss.elastic.co/u/SwethaS)\
**Post date:** [July 21, 2016, 10:28am UTC](https://discuss.elastic.co/t/elastic-search-2-3-4-mapperparsingexception-with-analyzer/56085/1 "2016-07-21T10:28:09Z")

</div>

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](https://discuss.elastic.co/t/add-plugins-from-classpath-in-embedded-elasticsearch-client-node/36269).

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?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 21, 2016, 10:40am UTC](https://discuss.elastic.co/t/elastic-search-2-3-4-mapperparsingexception-with-analyzer/56085/2 "2016-07-21T10:40:41Z")

</div>

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](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](https://github.com/elastic/elasticsearch/blob/2.4/plugins/analysis-kuromoji/src/main/java/org/elasticsearch/plugin/analysis/kuromoji/AnalysisKuromojiPlugin.java#L60)

---

<div class="post-metadata">

**Author:** ![SwethaS](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@SwethaS](https://discuss.elastic.co/u/SwethaS)\
**Post date:** [July 21, 2016, 1:48pm UTC](https://discuss.elastic.co/t/elastic-search-2-3-4-mapperparsingexception-with-analyzer/56085/3 "2016-07-21T13:48:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 21, 2016, 2:00pm UTC](https://discuss.elastic.co/t/elastic-search-2-3-4-mapperparsingexception-with-analyzer/56085/4 "2016-07-21T14:00:11Z")

</div>

How do you create the index/mapping?

---

<div class="post-metadata">

**Author:** ![SwethaS](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@SwethaS](https://discuss.elastic.co/u/SwethaS)\
**Post date:** [July 21, 2016, 2:13pm UTC](https://discuss.elastic.co/t/elastic-search-2-3-4-mapperparsingexception-with-analyzer/56085/5 "2016-07-21T14:13:37Z")

</div>

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" : {
        ----------
     }
}
}
```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 21, 2016, 3:10pm UTC](https://discuss.elastic.co/t/elastic-search-2-3-4-mapperparsingexception-with-analyzer/56085/6 "2016-07-21T15:10:00Z")

</div>

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](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/dynamic-templates.html).

Can you try without this "top level" analyzer?

---

<div class="post-metadata">

**Author:** ![SwethaS](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@SwethaS](https://discuss.elastic.co/u/SwethaS)\
**Post date:** [July 22, 2016, 4:40am UTC](https://discuss.elastic.co/t/elastic-search-2-3-4-mapperparsingexception-with-analyzer/56085/7 "2016-07-22T04:40:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SwethaS](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@SwethaS](https://discuss.elastic.co/u/SwethaS)\
**Post date:** [July 22, 2016, 4:57am UTC](https://discuss.elastic.co/t/elastic-search-2-3-4-mapperparsingexception-with-analyzer/56085/8 "2016-07-22T04:57:39Z")

</div>

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"
> }-
> }-
> }
> 
> ```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:33pm UTC](https://discuss.elastic.co/t/elastic-search-2-3-4-mapperparsingexception-with-analyzer/56085/9 "2017-07-05T22:33:33Z")

</div>


