docs: public ServiceCall<QueryResponse> query(QueryOptions queryOptions) {
      Validator.notNull(queryOptions, "queryOptions cannot be null");
      String[] pathSegments = { "v1/environments", "collections", "query" };
      String[] pathParameters = { queryOptions.environmentId(), queryOptions.collectionId() };
      RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
          pathParameters));
      builder.query("version", versionDate);
      Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "query");
      for (Entry<String, String> header : sdkHeaders.entrySet()) {
        builder.header(header.getKey(), header.getValue());
      }
      builder.header("Accept", "application/json");
      if (queryOptions.loggingOptOut() != null) {
        builder.header("X-Watson-Logging-Opt-Out", queryOptions.loggingOptOut());
      }
      final JsonObject contentJson = new JsonObject();
      if (queryOptions.filter() != null) {
        contentJson.addProperty("filter", queryOptions.filter());
      }
      if (queryOptions.query() != null) {
        contentJson.addProperty("query", queryOptions.query());
      }
      if (queryOptions.naturalLanguageQuery() != null) {
        contentJson.addProperty("natural_language_query", queryOptions.naturalLanguageQuery());
      }
      if (queryOptions.passages() != null) {
        contentJson.addProperty("passages", queryOptions.passages());
      }
      if (queryOptions.aggregation() != null) {
        contentJson.addProperty("aggregation", queryOptions.aggregation());
      }
      if (queryOptions.count() != null) {
        contentJson.addProperty("count", queryOptions.count());
      }
      if (queryOptions.returnFields() != null) {
        contentJson.addProperty("return", queryOptions.returnFields());
      }
      if (queryOptions.offset() != null) {
        contentJson.addProperty("offset", queryOptions.offset());
      }
      if (queryOptions.sort() != null) {
        contentJson.addProperty("sort", queryOptions.sort());
      }
      if (queryOptions.highlight() != null) {
        contentJson.addProperty("highlight", queryOptions.highlight());
      }
      if (queryOptions.passagesFields() != null) {
        contentJson.addProperty("passages.fields", queryOptions.passagesFields());
      }
      if (queryOptions.passagesCount() != null) {
        contentJson.addProperty("passages.count", queryOptions.passagesCount());
      }
      if (queryOptions.passagesCharacters() != null) {
        contentJson.addProperty("passages.characters", queryOptions.passagesCharacters());
      }
      if (queryOptions.deduplicate() != null) {
        contentJson.addProperty("deduplicate", queryOptions.deduplicate());
      }
      if (queryOptions.deduplicateField() != null) {
        contentJson.addProperty("deduplicate.field", queryOptions.deduplicateField());
      }
      if (queryOptions.collectionIds() != null) {
        contentJson.addProperty("collection_ids", queryOptions.collectionIds());
      }
      if (queryOptions.similar() != null) {
        contentJson.addProperty("similar", queryOptions.similar());
      }
      if (queryOptions.similarDocumentIds() != null) {
        contentJson.addProperty("similar.document_ids", queryOptions.similarDocumentIds());
      }
      if (queryOptions.similarFields() != null) {
        contentJson.addProperty("similar.fields", queryOptions.similarFields());
      }
      if (queryOptions.bias() != null) {
        contentJson.addProperty("bias", queryOptions.bias());
      }
      builder.bodyJson(contentJson);
      return createServiceCall(builder.build(), ResponseConverterUtils.getObject(QueryResponse.class));
    }