# Elasticsearch exception: Root mapping definition has unsupported parameters

**URL:** https://discuss.elastic.co/t/elasticsearch-exception-root-mapping-definition-has-unsupported-parameters/234630
**Category:** Elasticsearch
**Created:** [May 27, 2020, 10:53pm UTC](https://discuss.elastic.co/t/elasticsearch-exception-root-mapping-definition-has-unsupported-parameters/234630 "2020-05-27T22:53:24Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Cat](https://avatars.discourse-cdn.com/v4/letter/c/d07c76/32.png) [@Cat](https://discuss.elastic.co/u/Cat)
#### Post date: [May 27, 2020, 10:53pm UTC](https://discuss.elastic.co/t/elasticsearch-exception-root-mapping-definition-has-unsupported-parameters/234630/1 "2020-05-27T22:53:24Z")

</div>

When I used curl to create my template, it works fine. But when I used High Level REST it gave me the exception:

```auto
org.elasticsearch.ElasticsearchException: Elasticsearch exception [type=mapper_parsing_exception, reason=Root mapping definition has unsupported parameters: [document : {properties={cx_date={index=false, type=date}, doi_derived_from_publication={type=text}, publishing_poc={type=text}, sources={type=text}, cat_id={type=keyword}, title={type=text, fields={keyword={type=keyword}}}, coverages={type=text}, content={type=text}, DOI_end={type=date}, original_filename={type=text}, title_classification={type=text}, source_numbers={type=text}, summary={type=text}, requirements={type=text}, types={type=keyword}, identifiers={type=text}, topics={type=text}, cat_processed={type=date}, serial_number={type=text}, published={type=date}, classification={type=keyword}, url={type=text, fields={keyword={type=keyword}}}, publishing_organization={type=keyword}, cx={index=false, type=text}, special_instruction={type=text}, DOI_start={type=date}, contains_attachments={type=text}, cat_source={type=keyword}}}]]
	at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:509) ~[elasticsearch-6.8.3.jar!/:6.8.3]
	at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:420) ~[elasticsearch-6.8.3.jar!/:6.8.3]
	at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:450) ~[elasticsearch-6.8.3.jar!/:6.8.3]
	at org.elasticsearch.ElasticsearchException.failureFromXContent(ElasticsearchException.java:616) ~[elasticsearch-6.8.3.jar!/:6.8.3]
	at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:169) ~[elasticsearch-6.8.3.jar!/:6.8.3]
	at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:2053) ~[elasticsearch-rest-high-level-client-6.8.3.jar!/:6.8.3]
	at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:2030) ~[elasticsearch-rest-high-level-client-6.8.3.jar!/:6.8.3]
	at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1777) ~[elasticsearch-rest-high-level-client-6.8.3.jar!/:6.8.3]
	at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1734) ~[elasticsearch-rest-high-level-client-6.8.3.jar!/:6.8.3]
	at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1696) ~[elasticsearch-rest-high-level-client-6.8.3.jar!/:6.8.3]
	at org.elasticsearch.client.IndicesClient.putTemplate(IndicesClient.java:1539) ~[elasticsearch-rest-high-level-client-6.8.3.jar!/:6.8.3]
...

```

```auto
curl -s -H 'Content-Type: application/json' -X PUT 'http://<elasticsearch>:9200/_template/<templateName>' -d @templates/documentTemplate.json

```

```auto
try {
    PutIndexTemplateRequest request = new PutIndexTemplateRequest(<templateName>);
    request.source(documentTemplateJsonAsString, XContentType.JSON);
    client.indices().putTemplate(request, RequestOptions.DEFAULT).isAcknowledge())
} catch (final IOException e) {
...
}

```

```auto
{
   "order": 0,
   "version": 2,
   "index_patterns": [
      "documents_*"
   ],
   "settings": {
      "codec": "best_compression",
      "index": {
         "unassigned": {
            "node_left": {
               "delayed_timeout": "10m"
            }
         },
         "number_of_shards": "5",
         "number_of_replicas": "1",
         "blocks": {
            "read_only_allow_delete": "false"
         }
      }
   },
   "mappings": {
      "document": {
         "properties": {...}
   }
}

```

Elasticsearch version: 6.8.7  
Thank you for your help!

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [May 29, 2020, 1:25pm UTC](https://discuss.elastic.co/t/elasticsearch-exception-root-mapping-definition-has-unsupported-parameters/234630/2 "2020-05-29T13:25:38Z")

</div>

which version of the HLRC are you using in your java project?

---

<div class="post-metadata">

### Author: ![Cat](https://avatars.discourse-cdn.com/v4/letter/c/d07c76/32.png) [@Cat](https://discuss.elastic.co/u/Cat)
#### Post date: [May 29, 2020, 2:39pm UTC](https://discuss.elastic.co/t/elasticsearch-exception-root-mapping-definition-has-unsupported-parameters/234630/3 "2020-05-29T14:39:49Z")

</div>

6.8.3

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [June 2, 2020, 8:37am UTC](https://discuss.elastic.co/t/elasticsearch-exception-root-mapping-definition-has-unsupported-parameters/234630/4 "2020-06-02T08:37:04Z")

</div>

can you share the whole snippet including the data you put into the request, so that others can reproduce?

---

<div class="post-metadata">

### Author: ![Cat](https://avatars.discourse-cdn.com/v4/letter/c/d07c76/32.png) [@Cat](https://discuss.elastic.co/u/Cat)
#### Post date: [June 2, 2020, 3:03pm UTC](https://discuss.elastic.co/t/elasticsearch-exception-root-mapping-definition-has-unsupported-parameters/234630/5 "2020-06-02T15:03:14Z")

</div>

Not sure if this exception gives any more clues ...

```auto
"message": "Elasticsearch exception [type=mapper_parsing_exception, reason=Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [document : {properties={cx_date={index=false, type=date}, doi_derived_from_publication={type=text}, publishing_poc={type=text}, sources={type=text}, cat_id={type=keyword}, title={type=text, fields={keyword={type=keyword}}}, coverages={type=text}, content={type=text}, DOI_end={type=date}, original_filename={type=text}, title_classification={type=text}, source_numbers={type=text}, summary={type=text}, requirements={type=text}, types={type=keyword}, identifiers={type=text}, topics={type=text}, cat_processed={type=date}, serial_number={type=text}, published={type=date}, classification={type=keyword}, url={type=text, fields={keyword={type=keyword}}}, publishing_organization={type=keyword}, cx={index=false, type=text}, special_instruction={type=text}, DOI_start={type=date}, contains_attachments={type=text}, cat_source={type=keyword}}}]]"

```

---

<div class="post-metadata">

### Author: ![Cat](https://avatars.discourse-cdn.com/v4/letter/c/d07c76/32.png) [@Cat](https://discuss.elastic.co/u/Cat)
#### Post date: [June 10, 2020, 10:04pm UTC](https://discuss.elastic.co/t/elasticsearch-exception-root-mapping-definition-has-unsupported-parameters/234630/6 "2020-06-10T22:04:23Z")

</div>

```auto
    @Bean(destroyMethod = "close")
    public RestHighLevelClient client() {
        RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(
                new HttpHost(this.host, this.port, this.scheme),
                new HttpHost(this.backupHost, this.port, this.scheme)));
        return client;
    }

```

The actual code is very simple:

```auto
@Service
public class MyService {

    @Value("classpath:elasticsearch-scripts/templates/MyTemplate.json")
    Resource defaultTemplateResource;

    @Autowired
    private RestHighLevelClient client;

   public void createIndexTemplate() 
   {
      try {
         String defaultTemplateJsonStr = IOUtils.toString(
                    defaultTemplateResource.getInputStream(), "UTF-8");
         PutIndexTemplateRequest request = new PutIndexTemplateRequest(<templateName>);
         request.source(defaultTemplateJsonStr, XContentType.JSON);
         client.indices().putTemplate(request, RequestOptions.DEFAULT).isAcknowledge())
      } catch (final IOException e) {
         System.out.println("Exception: " + e);
      }
}

```

MyTemplate.json:

```auto
{
   "order": 0,
   "version": 2,
   "index_patterns": [
      "documents_*-v2*"
   ],
   "settings": {
      "codec": "best_compression",
      "index": {
         "unassigned": {
            "node_left": {
               "delayed_timeout": "10m"
            }
         },
         "number_of_shards": "5",
         "number_of_replicas": "1",
         "blocks": {
            "read_only_allow_delete": "false"
         }
      }
   },
   "mappings": {
      "document": {
         "properties": {
            "CAT_end": {
               "type": "date"
            },
            "CAT_start": {
               "type": "date"
            },
            "classification": {
               "type": "keyword"
            },
            "contains_attachments": {
               "type": "text"
            },
            "content": {
               "type": "text"
            },
            "coverages": {
               "type": "text"
            },
            "cx": {
               "type": "text",
               "index": false
            },
            "cx_date": {
               "type": "date",
               "index": false
            },
            "doi_derived_from_publication": {
               "type": "text"
            },
            "cat_id": {
               "type": "keyword"
            },
            "cat_processed": {
               "type": "date"
            },
            "cat_source": {
               "type": "keyword"
            },
            "identifiers": {
               "type": "text"
            },
            "original_filename": {
               "type": "text"
            },
            "published": {
               "type": "date"
            },
            "publishing_organization": {
               "type": "keyword"
            },
            "publishing_poc": {
               "type": "text"
            },
            "requirements": {
               "type": "text"
            },
            "serial_number": {
               "type": "text"
            },
            "source_numbers": {
               "type": "text"
            },
            "sources": {
               "type": "text"
            },
            "special_instruction": {
               "type": "text"
            },
            "summary": {
               "type": "text"
            },
            "title": {
               "type": "text",
               "fields": {
                  "keyword": {
                     "type": "keyword"
                  }
               }
            },
            "title_classification": {
               "type": "text"
            },
            "topics": {
               "type": "text"
            },
            "types": {
               "type": "keyword"
            },
            "url": {
               "type": "text",
               "fields": {
                  "keyword": {
                     "type": "keyword"
                  }
               }
            }
         }
      }
   }
}

```

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [June 30, 2020, 7:53am UTC](https://discuss.elastic.co/t/elasticsearch-exception-root-mapping-definition-has-unsupported-parameters/234630/7 "2020-06-30T07:53:20Z")

</div>

I am confused. the exception mentions `_doc` but it is nowhere mentioned in your code snippets.

Just to be sure: Are those JSON snippets the right ones?

---

<div class="post-metadata">

### Author: ![Cat](https://avatars.discourse-cdn.com/v4/letter/c/d07c76/32.png) [@Cat](https://discuss.elastic.co/u/Cat)
#### Post date: [July 7, 2020, 5:50pm UTC](https://discuss.elastic.co/t/elasticsearch-exception-root-mapping-definition-has-unsupported-parameters/234630/8 "2020-07-07T17:50:27Z")

</div>

Those are the correct one.

---

<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: [August 4, 2020, 5:50pm UTC](https://discuss.elastic.co/t/elasticsearch-exception-root-mapping-definition-has-unsupported-parameters/234630/9 "2020-08-04T17:50:35Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
