code: public JSONObject searchSynonyms(SynonymQuery query, RequestOptions requestOptions) throws AlgoliaException, JSONException {
      JSONObject body = new JSONObject().put("query", query.getQueryString());
      if (query.hasTypes()) {
        StringBuilder type = new StringBuilder();
        boolean first = true;
        for (SynonymQuery.SynonymType t : query.getTypes()) {
          if (!first) {
            type.append(",");
          }
          type.append(t.name);
          first = false;
        }
        body = body.put("type", type.toString());
      }
      if (query.getPage() != null) {
        body = body.put("page", query.getPage());
      }
      if (query.getHitsPerPage() != null) {
        body = body.put("hitsPerPage", query.getHitsPerPage());
      }
  
      return client.postRequest("/1/indexes/" + encodedIndexName + "/synonyms/search", body.toString(), false, true, requestOptions);
    }
docs: Search for synonyms
  
  @param query          the query
  @param requestOptions Options to pass to this request