I have the same problem when I am using Elasticsearch 5.3.0. You can see my problem here.
I try to change the Elasticsearch's dependency from 5.3.0 to 5.5.2, and it finally solve the problem. In fact you should keep the same version on both sides, this is really a rude way.
So now I am using ES 5.6.3 with REST Client and never meet such problem. You can try the latest version if possible.