Hi,
I am trying to create an index template that includes both dynamic templates as well as enabling the _size field. Here is what I am passing to the High Level Rest API
PutIndexTemplateRequest templateIndexRequest =
new PutIndexTemplateRequest("MyIndex*");
templateIndexRequest.mapping(<CONTENT BELOW>, XContentType.JSON);
{
"dynamic_templates":
[
{
"pk_variable": {
"match_mapping_type": "*",
"match": "*_pkVarValue",
"mapping": {
"type": "text",
"fields": {
"raw": { "type": "keyword" }
}
}
}
}
],
"_size": { "enabled" : true }
}
This gives me the following error:
ElasticsearchStatusException[Elasticsearch exception [type=mapper_parsing_exception, reason=Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [_size : {enabled=true}]]]; nested: ElasticsearchException[Elasticsearch exception [type=mapper_parsing_exception, reason=Root mapping definition has unsupported parameters: [_size : {enabled=true}]]];
at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177)
at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1793)
at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:1770)
at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1527)
at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1484)
at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1454)
at org.elasticsearch.client.IndicesClient.putTemplate(IndicesClient.java:1163)
Now if I remove:
"_size": { "enabled" : true }
Everything works fine. I have tried many different syntax, but don't seem to find one that works.
Any help appreciated.
Thanks,
Philippe