set_upgrade_mode is introduced in 6.7. It does not exist in 6.5.
The documentation states
When upgrading your cluster, in some circumstances you must restart your nodes and reindex your machine learning indices.
An upgrade from 6.5 -> 6.7 is not one of those circumstances as you should not have to reindex any of the internal machine learning indices.
The first time that this API will actually be necessary would be an upgrade from 6.7 -> 7.0 and IF you have machine learning indices that were created in 5.X. This is because those indices will need to be reindexed as Elasticsearch only supports indices that are one major version behind (e.g. 5.X indices will NOT be supported in 7.X).
So, to upgrade from 6.5->6.7 the old process that includes stopping all ML jobs and datafeeds should be followed. To quote the section about upgrading TO 6.7:
Consider closing machine learning jobs before you start the upgrade process. It is not required, but there are pros and cons to leaving the jobs running.
Since you are on 6.5, I would use the 6.5 docs on how to perform a rolling upgrade: https://www.elastic.co/guide/en/elasticsearch/reference/6.5/rolling-upgrades.html