WARNING: Version 1.6 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Transform script cannot be added to an existing mapping for an index type (regardless of whether the mapping currently uses transform or have any data at all). In other words, transform script has to be added at mapping creation time for an index type.
Also, once configured the transform script cannot be modified. This is not because that is technically impossible but instead because madness lies down that road.