docs: def federated_query(self,
                          environment_id,
                          filter=None,
                          query=None,
                          natural_language_query=None,
                          passages=None,
                          aggregation=None,
                          count=None,
                          return_fields=None,
                          offset=None,
                          sort=None,
                          highlight=None,
                          passages_fields=None,
                          passages_count=None,
                          passages_characters=None,
                          deduplicate=None,
                          deduplicate_field=None,
                          collection_ids=None,
                          similar=None,
                          similar_document_ids=None,
                          similar_fields=None,
                          bias=None,
                          logging_opt_out=None,
                          **kwargs):
          """
          Long environment queries.
  
          Complex queries might be too long for a standard method query. By using this
          method, you can construct longer queries. However, these queries may take longer
          to complete than the standard method. For details, see the [Discovery service
          documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-query-concepts#query-concepts).
  
          :param str environment_id: The ID of the environment.
          :param str filter: A cacheable query that excludes documents that don't mention
          the query content. Filter searches are better for metadata-type searches and for
          assessing the concepts in the data set.
          :param str query: A query search returns all documents in your data set with full
          enrichments and full text, but with the most relevant documents listed first. Use
          a query search when you want to find the most relevant search results. You cannot
          use **natural_language_query** and **query** at the same time.
          :param str natural_language_query: A natural language query that returns relevant
          documents by utilizing training data and natural language understanding. You
          cannot use **natural_language_query** and **query** at the same time.
          :param bool passages: A passages query that returns the most relevant passages
          from the results.
          :param str aggregation: An aggregation search that returns an exact answer by
          combining query search with filters. Useful for applications to build lists,
          tables, and time series. For a full list of possible aggregations, see the Query
          reference.
          :param int count: Number of results to return.
          :param str return_fields: A comma-separated list of the portion of the document
          hierarchy to return.
          :param int offset: The number of query results to skip at the beginning. For
          example, if the total number of results that are returned is 10 and the offset is
          8, it returns the last two results.
          :param str sort: A comma-separated list of fields in the document to sort on. You
          can optionally specify a sort direction by prefixing the field with `-` for
          descending or `+` for ascending. Ascending is the default sort direction if no
          prefix is specified. This parameter cannot be used in the same query as the
          **bias** parameter.
          :param bool highlight: When true, a highlight field is returned for each result
          which contains the fields which match the query with `<em></em>` tags around the
          matching query terms.
          :param str passages_fields: A comma-separated list of fields that passages are
          drawn from. If this parameter not specified, then all top-level fields are
          included.
          :param int passages_count: The maximum number of passages to return. The search
          returns fewer passages if the requested total is not found. The default is `10`.
          The maximum is `100`.
          :param int passages_characters: The approximate number of characters that any one
          passage will have.
          :param bool deduplicate: When `true`, and used with a Watson Discovery News
          collection, duplicate results (based on the contents of the **title** field) are
          removed. Duplicate comparison is limited to the current query only; **offset** is
          not considered. This parameter is currently Beta functionality.
          :param str deduplicate_field: When specified, duplicate results based on the field
          specified are removed from the returned results. Duplicate comparison is limited
          to the current query only, **offset** is not considered. This parameter is
          currently Beta functionality.
          :param str collection_ids: A comma-separated list of collection IDs to be queried
          against. Required when querying multiple collections, invalid when performing a
          single collection query.
          :param bool similar: When `true`, results are returned based on their similarity
          to the document IDs specified in the **similar.document_ids** parameter.
          :param str similar_document_ids: A comma-separated list of document IDs to find
          similar documents.
          **Tip:** Include the **natural_language_query** parameter to expand the scope of
          the document similarity search with the natural language query. Other query
          parameters, such as **filter** and **query**, are subsequently applied and reduce
          the scope.
          :param str similar_fields: A comma-separated list of field names that are used as
          a basis for comparison to identify similar documents. If not specified, the entire
          document is used for comparison.
          :param str bias: Field which the returned results will be biased against. The
          specified field must be either a **date** or **number** format. When a **date**
          type field is specified returned results are biased towards field values closer to
          the current date. When a **number** type field is specified, returned results are
          biased towards higher field values. This parameter cannot be used in the same
          query as the **sort** parameter.
          :param bool logging_opt_out: If `true`, queries are not stored in the Discovery
          **Logs** endpoint.
          :param dict headers: A `dict` containing the request headers
          :return: A `DetailedResponse` containing the result, headers and HTTP status code.
          :rtype: DetailedResponse
          """
  
          if environment_id is None:
              raise ValueError('environment_id must be provided')
  
          headers = {'X-Watson-Logging-Opt-Out': logging_opt_out}
          if 'headers' in kwargs:
              headers.update(kwargs.get('headers'))
          sdk_headers = get_sdk_headers('discovery', 'V1', 'federated_query')
          headers.update(sdk_headers)
  
          params = {'version': self.version}
  
          data = {
              'filter': filter,
              'query': query,
              'natural_language_query': natural_language_query,
              'passages': passages,
              'aggregation': aggregation,
              'count': count,
              'return': return_fields,
              'offset': offset,
              'sort': sort,
              'highlight': highlight,
              'passages.fields': passages_fields,
              'passages.count': passages_count,
              'passages.characters': passages_characters,
              'deduplicate': deduplicate,
              'deduplicate.field': deduplicate_field,
              'collection_ids': collection_ids,
              'similar': similar,
              'similar.document_ids': similar_document_ids,
              'similar.fields': similar_fields,
              'bias': bias
          }
  
          url = '/v1/environments/{0}/query'.format(
              *self._encode_path_vars(environment_id))
          response = self.request(
              method='POST',
              url=url,
              headers=headers,
              params=params,
              json=data,
              accept_json=True)
          return response