# Pushing index templates fails on 7.9 with Java transport client

**URL:** <https://discuss.elastic.co/t/pushing-index-templates-fails-on-7-9-with-java-transport-client/248151>\
**Category:** Elasticsearch\
**Created:** [September 10, 2020, 11:01am UTC](https://discuss.elastic.co/t/pushing-index-templates-fails-on-7-9-with-java-transport-client/248151 "2020-09-10T11:01:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amugofjava](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amugofjava/32/75350_2.png) [@amugofjava](https://discuss.elastic.co/u/amugofjava)\
**Post date:** [September 10, 2020, 11:01am UTC](https://discuss.elastic.co/t/pushing-index-templates-fails-on-7-9-with-java-transport-client/248151/1 "2020-09-10T11:01:20Z")

</div>

I am in the progress of migrating from 6.8 to 7.9. I have updated my index templates to work with the 7.9 format and if I submit the template via REST it installs fine; however, if I use the `PutIndexTemplateRequest` with the Java transport client it fails, complaining that it doesn't know what priority or meta is.

I know the Java transport client is now deprecated, but I'm trying to migrate one part at a time. I have created a cut-down template as an example to highlight the issue. The following template installs correctly when pushing over REST using Postman:

`PUT localhost:9200/_index_template/simple-template-example`

```auto
{
  "index_patterns": [
    "my-indexes*"
  ],
  "template": {
    "settings": {
      "index": {
        "number_of_shards": "1",
        "number_of_replicas": "1",
        "refresh_interval": "4s"
      }
    },
    "mappings": {
      "properties": {
        "@timestamp": {
          "type": "date",
          "format": "YYYY-MM-dd'T'HH:mm:ssZ",
          "index": true
        },
        "checksum": {
          "type": "keyword",
          "index": true,
          "norms": false
        },
        "clientId": {
          "type": "long",
          "index": true
        },
        "issue": {
          "type": "text",
          "index": true,
          "norms": false,
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        }
      }
    }
  },
  "priority": 200,
  "version": 1,
  "_meta": {
    "description": "Example index that works fine via REST but fails via Java client"
  }
}

```

If I push the same template with the transport client it rejects the priority tag and fails. I had no issue pushing templates in Java with 6.8, but with 7.9 it fails. I have also tried pushing it a few different ways:

```auto
client.admin().indices().putTemplate(
        new PutIndexTemplateRequest(filename).source(content.getBytes(), XContentType.JSON)
);

```

or

```auto
PutIndexTemplateRequest request = new PutIndexTemplateRequest(filename);
request.source(content, XContentType.JSON);
AcknowledgedResponse response = client.admin().indices().execute(PutIndexTemplateAction.INSTANCE, request).get();

```

Can anyone see what I am doing wrong?

Thanks.

---

<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:** [October 8, 2020, 11:01am UTC](https://discuss.elastic.co/t/pushing-index-templates-fails-on-7-9-with-java-transport-client/248151/2 "2020-10-08T11:01:21Z")

</div>

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