How to create Template for an index using Java API?

PUT /_template/some_template
{
  "template": "some_*",
  "settings": {
    "index.store.type": "default",
    "index": {
      "number_of_shards": 5,
      "number_of_replicas": 1,
      "refresh_interval": "60s"
    },
    "analysis": {
      "filter": {
        "porter_stemmer_en_EN": {
          "type": "stemmer",
          "name": "porter"
        }
      }
    }
  },
  "mappings": {
    "_default_": {
      "dynamic": "strict",
      "properties": {
        "docset_id": {
          "include_in_all": false,
          "type": "string",
          "index": "not_analyzed"
        },
        "doc_id": {
          "include_in_all": false,
          "type": "string",
          "index": "not_analyzed"
        },
        "plain_text": {
          "type": "string",
          "store": true
        }
      }
    }
  }
}

I have this template. How should I use this in Java API ?