I just discovered a strange behavior of the TransportClient in ES 5.6.11. Maybe a bug, maybe just wrong usage. When I store a script via the TransportClient then all fields but the first field get lost in the source. When I store the same script source via REST it works fine.
This sounds like a possible bug in how stored scripts are parsed, but that code has undergone a lot of refactoring since 5.6. In fact, the way you are passing your template (at the root of the request) is deprecated, and just recently removed in master for 7.0. I recommend moving your template inside a script element, which is the new way of doing things (so all scripts are the same, whether they are templates or not):
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.