nodes: 0, module; 1, function_definition; 2, function_name:federated_query; 3, parameters; 4, block; 5, identifier:self; 6, identifier:environment_id; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, default_parameter; 16, default_parameter; 17, default_parameter; 18, default_parameter; 19, default_parameter; 20, default_parameter; 21, default_parameter; 22, default_parameter; 23, default_parameter; 24, default_parameter; 25, default_parameter; 26, default_parameter; 27, default_parameter; 28, dictionary_splat_pattern; 29, expression_statement; 30, if_statement; 31, expression_statement; 32, if_statement; 33, expression_statement; 34, expression_statement; 35, expression_statement; 36, expression_statement; 37, expression_statement; 38, expression_statement; 39, return_statement; 40, identifier:filter; 41, None; 42, identifier:query; 43, None; 44, identifier:natural_language_query; 45, None; 46, identifier:passages; 47, None; 48, identifier:aggregation; 49, None; 50, identifier:count; 51, None; 52, identifier:return_fields; 53, None; 54, identifier:offset; 55, None; 56, identifier:sort; 57, None; 58, identifier:highlight; 59, None; 60, identifier:passages_fields; 61, None; 62, identifier:passages_count; 63, None; 64, identifier:passages_characters; 65, None; 66, identifier:deduplicate; 67, None; 68, identifier:deduplicate_field; 69, None; 70, identifier:collection_ids; 71, None; 72, identifier:similar; 73, None; 74, identifier:similar_document_ids; 75, None; 76, identifier:similar_fields; 77, None; 78, identifier:bias; 79, None; 80, identifier:logging_opt_out; 81, None; 82, identifier:kwargs; 83, comment:"""
          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
          """; 84, comparison_operator:environment_id is None; 85, block; 86, assignment; 87, comparison_operator:'headers' in kwargs; 88, block; 89, assignment; 90, call; 91, assignment; 92, assignment; 93, assignment; 94, assignment; 95, identifier:response; 96, identifier:environment_id; 97, None; 98, raise_statement; 99, identifier:headers; 100, dictionary; 101, string; 102, identifier:kwargs; 103, expression_statement; 104, identifier:sdk_headers; 105, call; 106, attribute; 107, argument_list; 108, identifier:params; 109, dictionary; 110, identifier:data; 111, dictionary; 112, identifier:url; 113, call; 114, identifier:response; 115, call; 116, call; 117, pair; 118, string_content:headers; 119, call; 120, identifier:get_sdk_headers; 121, argument_list; 122, identifier:headers; 123, identifier:update; 124, identifier:sdk_headers; 125, pair; 126, pair; 127, pair; 128, pair; 129, pair; 130, pair; 131, pair; 132, pair; 133, pair; 134, pair; 135, pair; 136, pair; 137, pair; 138, pair; 139, pair; 140, pair; 141, pair; 142, pair; 143, pair; 144, pair; 145, pair; 146, attribute; 147, argument_list; 148, attribute; 149, argument_list; 150, identifier:ValueError; 151, argument_list; 152, string; 153, identifier:logging_opt_out; 154, attribute; 155, argument_list; 156, string; 157, string; 158, string; 159, string; 160, attribute; 161, string; 162, identifier:filter; 163, string; 164, identifier:query; 165, string; 166, identifier:natural_language_query; 167, string; 168, identifier:passages; 169, string; 170, identifier:aggregation; 171, string; 172, identifier:count; 173, string; 174, identifier:return_fields; 175, string; 176, identifier:offset; 177, string; 178, identifier:sort; 179, string; 180, identifier:highlight; 181, string; 182, identifier:passages_fields; 183, string; 184, identifier:passages_count; 185, string; 186, identifier:passages_characters; 187, string; 188, identifier:deduplicate; 189, string; 190, identifier:deduplicate_field; 191, string; 192, identifier:collection_ids; 193, string; 194, identifier:similar; 195, string; 196, identifier:similar_document_ids; 197, string; 198, identifier:similar_fields; 199, string; 200, identifier:bias; 201, string; 202, identifier:format; 203, list_splat; 204, identifier:self; 205, identifier:request; 206, keyword_argument; 207, keyword_argument; 208, keyword_argument; 209, keyword_argument; 210, keyword_argument; 211, keyword_argument; 212, string; 213, string_content:X-Watson-Logging-Opt-Out; 214, identifier:headers; 215, identifier:update; 216, call; 217, string_content:discovery; 218, string_content:V1; 219, string_content:federated_query; 220, string_content:version; 221, identifier:self; 222, identifier:version; 223, string_content:filter; 224, string_content:query; 225, string_content:natural_language_query; 226, string_content:passages; 227, string_content:aggregation; 228, string_content:count; 229, string_content:return; 230, string_content:offset; 231, string_content:sort; 232, string_content:highlight; 233, string_content:passages.fields; 234, string_content:passages.count; 235, string_content:passages.characters; 236, string_content:deduplicate; 237, string_content:deduplicate.field; 238, string_content:collection_ids; 239, string_content:similar; 240, string_content:similar.document_ids; 241, string_content:similar.fields; 242, string_content:bias; 243, string_content:/v1/environments/{0}/query; 244, call; 245, identifier:method; 246, string; 247, identifier:url; 248, identifier:url; 249, identifier:headers; 250, identifier:headers; 251, identifier:params; 252, identifier:params; 253, identifier:json; 254, identifier:data; 255, identifier:accept_json; 256, True; 257, string_content:environment_id must be provided; 258, attribute; 259, argument_list; 260, attribute; 261, argument_list; 262, string_content:POST; 263, identifier:kwargs; 264, identifier:get; 265, string; 266, identifier:self; 267, identifier:_encode_path_vars; 268, identifier:environment_id; 269, string_content:headers
code: 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