Querying dense_vector from the High Level REST Java API

That's it, however I would appreciate an example on how to translate the example vector query from the docs to the Java HL REST API. I haven't been able to find one for Java, although there are examples for other languages.

{
  "size" : 5,
  "query": {
    "script_score": {
      "query" : {
        "match_all" : {}
      },
      "script": {
        "source": "cosineSimilarity(params.queryVector, title_vector) + 1.0",
        "params": {
          "title_vector": [1,2,3]
        }
      }
    }
  }
}