# Method: query.search

- [HTTP request](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#body.HTTP_TEMPLATE)
- [Request body](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#body.request_body)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#body.response_body)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#body.SearchResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#body.aspect)
- [QueryInterpretationOptions](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#QueryInterpretationOptions)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#QueryInterpretationOptions.SCHEMA_REPRESENTATION)
- [QueryInterpretation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#QueryInterpretation)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#QueryInterpretation.SCHEMA_REPRESENTATION)
- [QueryInterpretation.InterpretationType](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#QueryInterpretation.InterpretationType)
- [QueryInterpretation.Reason](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#QueryInterpretation.Reason)
- [SearchResult](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SearchResult)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SearchResult.SCHEMA_REPRESENTATION)
- [Snippet](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#Snippet)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#Snippet.SCHEMA_REPRESENTATION)
- [MatchRange](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#MatchRange)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#MatchRange.SCHEMA_REPRESENTATION)
- [Metadata](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#Metadata)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#Metadata.SCHEMA_REPRESENTATION)
- [ResultDisplayMetadata](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultDisplayMetadata)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultDisplayMetadata.SCHEMA_REPRESENTATION)
- [ResultDisplayMetadata.ResultDisplayLine](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultDisplayMetadata.ResultDisplayLine)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultDisplayMetadata.ResultDisplayLine.SCHEMA_REPRESENTATION)
- [ResultDisplayMetadata.ResultDisplayField](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultDisplayMetadata.ResultDisplayField)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultDisplayMetadata.ResultDisplayField.SCHEMA_REPRESENTATION)
- [ResultDebugInfo](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultDebugInfo)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultDebugInfo.SCHEMA_REPRESENTATION)
- [StructuredResult](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#StructuredResult)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#StructuredResult.SCHEMA_REPRESENTATION)
- [SpellResult](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SpellResult)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SpellResult.SCHEMA_REPRESENTATION)
- [SpellResult.SuggestionType](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SpellResult.SuggestionType)
- [SafeHtmlProto](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SafeHtmlProto)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SafeHtmlProto.SCHEMA_REPRESENTATION)
- [FacetResult](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#FacetResult)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#FacetResult.SCHEMA_REPRESENTATION)
- [FacetBucket](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#FacetBucket)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#FacetBucket.SCHEMA_REPRESENTATION)
- [ResponseDebugInfo](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResponseDebugInfo)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResponseDebugInfo.SCHEMA_REPRESENTATION)
- [ErrorInfo](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ErrorInfo)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ErrorInfo.SCHEMA_REPRESENTATION)
- [ErrorMessage](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ErrorMessage)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ErrorMessage.SCHEMA_REPRESENTATION)
- [ResultCounts](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultCounts)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultCounts.SCHEMA_REPRESENTATION)
- [SourceResultCount](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SourceResultCount)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SourceResultCount.SCHEMA_REPRESENTATION)
- [Try it!](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#try-it)

The Cloud Search query API provides the search method, which returns the most relevant results from a user query. The results can come from Google Workspace apps, such as Gmail or Google Drive, or they can come from data that you have indexed from a third party.

**Note:** This API requires a standard end user account to execute. A service account can't perform query API requests directly; to use a service account to perform queries, set up [Google Workspace domain-wide delegation of authority](https://developers.google.com/workspace/cloud-search/docs/guides/delegation/).

### HTTP request

`POST https://cloudsearch.googleapis.com/v1/query/search`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "requestOptions": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/RequestOptions`) }, "query": string, "pageSize": integer, "start": integer, "dataSourceRestrictions": [ { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#DataSourceRestriction`) } ], "facetOptions": [ { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#FacetOptions`) } ], "sortOptions": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#SortOptions`) }, "queryInterpretationOptions": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#QueryInterpretationOptions`) }, "contextAttributes": [ { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/indexing.datasources.items#ContextAttribute`) } ] } ``` |

| Fields ||
|---|---|
| `requestOptions` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/RequestOptions`)`` Request options, such as the search application and user timezone. |
| `query` | `string` The raw query string. See supported search operators in the [Narrow your search with operators](https://support.google.com/cloudsearch/answer/6172299) |
| `pageSize` | `integer` Maximum number of search results to return in one page. Valid values are between 1 and 100, inclusive. Default value is 10. Minimum value is 50 when results beyond 2000 are requested. |
| `start` | `integer` Starting index of the results. |
| `dataSourceRestrictions[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#DataSourceRestriction`)`` The sources to use for querying. If not specified, all data sources from the current search application are used. |
| `facetOptions[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#FacetOptions`)`` |
| `sortOptions` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#SortOptions`)`` The options for sorting the search results |
| `queryInterpretationOptions` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#QueryInterpretationOptions`)`` options to interpret the user query. |
| `contextAttributes[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/indexing.datasources.items#ContextAttribute`)`` Context attributes for the request which will be used to adjust ranking of search results. The maximum number of elements is 10. |

### Response body

The search API response. NEXT id: 19

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "queryInterpretation": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#QueryInterpretation`) }, "results": [ { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SearchResult`) } ], "structuredResults": [ { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#StructuredResult`) } ], "spellResults": [ { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SpellResult`) } ], "facetResults": [ { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#FacetResult`) } ], "hasMoreResults": boolean, "debugInfo": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResponseDebugInfo`) }, "errorInfo": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ErrorInfo`) }, "resultCounts": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultCounts`) }, "resultCountEstimate": string, "resultCountExact": string } ``` |

| Fields ||
|---|---|
| `queryInterpretation` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#QueryInterpretation`)`` query interpretation result for user query. Empty if query interpretation is disabled. |
| `results[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SearchResult`)`` Results from a search query. |
| `structuredResults[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#StructuredResult`)`` Structured results for the user query. These results are not counted against the pageSize. |
| `spellResults[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SpellResult`)`` Suggested spelling for the query. |
| `facetResults[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#FacetResult`)`` Repeated facet results. |
| `hasMoreResults` | `boolean` Whether there are more search results matching the query. |
| `debugInfo` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResponseDebugInfo`)`` Debugging information about the response. |
| `errorInfo` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ErrorInfo`)`` Error information about the response. |
| `resultCounts` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultCounts`)`` Expanded result count information. |
| Union field `result_count`. The total result count across all requested data sources. Omitted if predefined sources are included in the set of data sources queried. Result counts might be returned as an estimate, instead of exact, under the following circumstances: - When the query has more than 2 terms in a phrase, such as "result count exact" in quotes. - When the number of unique search result ACLs to evaluate are too large to compute within a reasonable latency. In the rare case when the system is unable to search through all documents, rerun the query. `result_count` can be only one of the following: ||
| `resultCountEstimate` | `string (https://developers.google.com/discovery/v1/type-format format)` The estimated result count for this query. |
| `resultCountExact` | `string (https://developers.google.com/discovery/v1/type-format format)` The exact result count for this query. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud_search.query`
- `https://www.googleapis.com/auth/cloud_search`

For more information, see the [Authorization guide](https://developers.google.com/workspace/guides/configure-oauth-consent).

## QueryInterpretationOptions

options to interpret user query.

| JSON representation |
|---|
| ``` { "disableNlInterpretation": boolean, "enableVerbatimMode": boolean, "disableSupplementalResults": boolean } ``` |

| Fields ||
|---|---|
| `disableNlInterpretation` | `boolean` Flag to disable natural language (NL) interpretation of queries. Default is false, Set to true to disable natural language interpretation. NL interpretation only applies to predefined datasources. |
| `enableVerbatimMode` | `boolean` Enable this flag to turn off all internal optimizations like natural language (NL) interpretation of queries, supplemental result retrieval, and usage of synonyms including custom ones. Nl interpretation will be disabled if either one of the two flags is true. |
| `disableSupplementalResults` | `boolean` Use this flag to disable supplemental results for a query. Supplemental results setting chosen at SearchApplication level will take precedence if set to True. |

## QueryInterpretation

| JSON representation |
|---|
| ``` { "interpretedQuery": string, "interpretationType": enum (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#QueryInterpretation.InterpretationType`), "reason": enum (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#QueryInterpretation.Reason`), "interpretedQueryActualResultCount": integer, "interpretedQueryEstimatedResultCount": string } ``` |

| Fields ||
|---|---|
| `interpretedQuery` | `string` The interpretation of the query used in search. For example, queries with natural language intent like "email from john" will be interpreted as "from:john source:mail". This field will not be filled when the reason is NOT_ENOUGH_RESULTS_FOUND_FOR_USER_QUERY. |
| `interpretationType` | ``enum (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#QueryInterpretation.InterpretationType`)`` |
| `reason` | ``enum (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#QueryInterpretation.Reason`)`` The reason for interpretation of the query. This field will not be UNSPECIFIED if the interpretation type is not NONE. |
| `interpretedQueryActualResultCount` | `integer` The actual number of results returned by the interpreted query. |
| `interpretedQueryEstimatedResultCount` | `string (https://developers.google.com/discovery/v1/type-format format)` The estimated number of results returned by the interpreted query. |

## QueryInterpretation.InterpretationType

| Enums ||
|---|---|
| `NONE` | Neither the natural language interpretation, nor a broader version of the query is used to fetch the search results. |
| `BLEND` | The results from original query are blended with other results. The reason for blending these other results with the results from original query is populated in the 'reason' field below. |
| `REPLACE` | The results from original query are replaced. The reason for replacing the results from original query is populated in the 'reason' field below. |

## QueryInterpretation.Reason

| Enums ||
|---|---|
| `UNSPECIFIED` |   |
| `QUERY_HAS_NATURAL_LANGUAGE_INTENT` | Natural language interpretation of the query is used to fetch the search results. |
| `NOT_ENOUGH_RESULTS_FOUND_FOR_USER_QUERY` | query and document terms similarity is used to selectively broaden the query to retrieve additional search results since enough results were not found for the user query. Interpreted query will be empty for this case. |

## SearchResult

Results containing indexed information for a document. Next id: 16

| JSON representation |
|---|
| ``` { "title": string, "url": string, "snippet": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#Snippet`) }, "metadata": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#Metadata`) }, "clusteredResults": [ { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SearchResult`) } ], "debugInfo": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultDebugInfo`) } } ``` |

| Fields ||
|---|---|
| `title` | `string` title of the search result. |
| `url` | `string` The URL of the search result. The URL contains a Google redirect to the actual item. This URL is signed and shouldn't be changed. |
| `snippet` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#Snippet`)`` The concatenation of all snippets (summaries) available for this result. |
| `metadata` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#Metadata`)`` metadata of the search result. |
| `clusteredResults[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SearchResult`)`` If source is clustered, provide list of clustered results. There will only be one level of clustered results. If current source is not enabled for clustering, this field will be empty. |
| `debugInfo` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultDebugInfo`)`` Debugging information about this search result. |

## Snippet

Snippet of the search result, which summarizes the content of the resulting page.

| JSON representation |
|---|
| ``` { "snippet": string, "matchRanges": [ { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#MatchRange`) } ] } ``` |

| Fields ||
|---|---|
| `snippet` | `string` The snippet of the document. May contain escaped HTML character that should be unescaped prior to rendering. |
| `matchRanges[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#MatchRange`)`` The matched ranges in the snippet. |

## MatchRange

Matched range of a snippet \[start, end).

| JSON representation |
|---|
| ``` { "start": integer, "end": integer } ``` |

| Fields ||
|---|---|
| `start` | `integer` Starting position of the match in the snippet. |
| `end` | `integer` End of the match in the snippet. |

## Metadata

metadata of a matched search result.

| JSON representation |
|---|
| ``` { "source": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#Source`) }, "mimeType": string, "thumbnailUrl": string, "owner": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/Person`) }, "createTime": string, "updateTime": string, "fields": [ { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/indexing.datasources.items#NamedProperty`) } ], "displayOptions": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultDisplayMetadata`) }, "objectType": string } ``` |

| Fields ||
|---|---|
| `source` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#Source`)`` The named source for the result, such as Gmail. |
| `mimeType` | `string` Mime type of the search result. |
| `thumbnailUrl` | `string` The thumbnail URL of the result. |
| `owner` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/Person`)`` owner (usually creator) of the document or object of the search result. |
| `createTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` The creation time for this document or object in the search result. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `updateTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` The last modified date for the object in the search result. If not set in the item, the value returned here is empty. When `updateTime` is used for calculating freshness and is not set, this value defaults to 2 years from the current time. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `fields[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/indexing.datasources.items#NamedProperty`)`` Indexed fields in structured data, returned as a generic named property. |
| `displayOptions` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultDisplayMetadata`)`` options that specify how to display a structured data search result. |
| `objectType` | `string` Object type of the search result. |

## ResultDisplayMetadata

| JSON representation |
|---|
| ``` { "objectTypeLabel": string, "metalines": [ { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultDisplayMetadata.ResultDisplayLine`) } ] } ``` |

| Fields ||
|---|---|
| `objectTypeLabel` | `string` The display label for the object. |
| `metalines[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultDisplayMetadata.ResultDisplayLine`)`` The metalines content to be displayed with the result. |

## ResultDisplayMetadata.ResultDisplayLine

The collection of fields that make up a displayed line

| JSON representation |
|---|
| ``` { "fields": [ { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultDisplayMetadata.ResultDisplayField`) } ] } ``` |

| Fields ||
|---|---|
| `fields[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ResultDisplayMetadata.ResultDisplayField`)`` |

## ResultDisplayMetadata.ResultDisplayField

Display Fields for query.search Results

| JSON representation |
|---|
| ``` { "label": string, "operatorName": string, "property": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/indexing.datasources.items#NamedProperty`) } } ``` |

| Fields ||
|---|---|
| `label` | `string` The display label for the property. |
| `operatorName` | `string` The operator name of the property. |
| `property` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/indexing.datasources.items#NamedProperty`)`` The name value pair for the property. |

## ResultDebugInfo

Debugging information about the result.

| JSON representation |
|---|
| ``` { "formattedDebugInfo": string } ``` |

| Fields ||
|---|---|
| `formattedDebugInfo` | `string` General debug info formatted for display. |

## StructuredResult

Structured results that are returned as part of search request.

| JSON representation |
|---|
| ``` { "person": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/Person`) } } ``` |

| Fields ||
|---|---|
| Union field `structured_result`. `structured_result` can be only one of the following: ||
| `person` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/Person`)`` Representation of a person |

## SpellResult

| JSON representation |
|---|
| ``` { "suggestedQuery": string, "suggestionType": enum (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SpellResult.SuggestionType`), "suggestedQueryHtml": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SafeHtmlProto`) } } ``` |

| Fields ||
|---|---|
| `suggestedQuery` | `string` The suggested spelling of the query. |
| `suggestionType` | ``enum (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SpellResult.SuggestionType`)`` suggestion triggered for the current query. |
| `suggestedQueryHtml` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SafeHtmlProto`)`` The sanitized HTML representing the spell corrected query that can be used in the UI. This usually has language-specific tags to mark up parts of the query that are spell checked. |

## SpellResult.SuggestionType

The type of suggestion triggered for the query.

| Enums ||
|---|---|
| `SUGGESTION_TYPE_UNSPECIFIED` | Default spell check type |
| `NON_EMPTY_RESULTS_SPELL_SUGGESTION` | Spell suggestion without any results changed. The results are still shown for the original query (which has non zero / results) with a suggestion for spelling that would have results. |
| `ZERO_RESULTS_FULL_PAGE_REPLACEMENT` | Spell suggestion triggered when original query has no results. When the original query has no results, and spell suggestion has results we trigger results for the spell corrected query. |

## SafeHtmlProto

IMPORTANT: It is unsafe to accept this message from an untrusted source, since it's trivial for an attacker to forge serialized messages that don't fulfill the type's safety contract -- for example, it could contain attacker controlled script. A system which receives a SafeHtmlProto implicitly trusts the producer of the SafeHtmlProto. So, it's generally safe to return this message in RPC responses, but generally unsafe to accept it in RPC requests.

| JSON representation |
|---|
| ``` { "privateDoNotAccessOrElseSafeHtmlWrappedValue": string } ``` |

| Fields ||
|---|---|
| `privateDoNotAccessOrElseSafeHtmlWrappedValue` | `string` IMPORTANT: Never set or read this field, even from tests, it is private. See documentation at the top of .proto file for programming language packages with which to create or read this message. |

## FacetResult

Source specific facet response

| JSON representation |
|---|
| ``` { "sourceName": string, "objectType": string, "operatorName": string, "buckets": [ { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#FacetBucket`) } ] } ``` |

| Fields ||
|---|---|
| `sourceName` | `string` Source name for which facet results are returned. Will not be empty. |
| `objectType` | `string` Object type for which facet results are returned. Can be empty. |
| `operatorName` | `string` The name of the operator chosen for faceting. @see cloudsearch.SchemaPropertyOptions |
| `buckets[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#FacetBucket`)`` FacetBuckets for values in response containing at least a single result with the corresponding filter. |

## FacetBucket

A bucket in a facet is the basic unit of operation. A bucket can comprise either a single value OR a contiguous range of values, depending on the type of the field bucketed. FacetBucket is currently used only for returning the response object.

| JSON representation |
|---|
| ``` { "count": integer, "percentage": integer, "filter": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#Filter`) }, "value": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#Value`) } } ``` |

| Fields ||
|---|---|
| `count` | `integer` Number of results that match the bucket value. Counts are only returned for searches when count accuracy is ensured. Cloud Search does not guarantee facet counts for any query and facet counts might be present only intermittently, even for identical queries. Do not build dependencies on facet count existence; instead use facet ount percentages which are always returned. |
| `percentage` | `integer` Percent of results that match the bucket value. The returned value is between (0-100\], and is rounded down to an integer if fractional. If the value is not explicitly returned, it represents a percentage value that rounds to 0. Percentages are returned for all searches, but are an estimate. Because percentages are always returned, you should render percentages instead of counts. |
| `filter` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#Filter`)`` Filter to be passed in the search request if the corresponding bucket is selected. |
| Union field `bucket_value`. The range or value of the bucket that is faceted `bucket_value` can be only one of the following: ||
| `value` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#Value`)`` |

## ResponseDebugInfo

Debugging information about the response.

| JSON representation |
|---|
| ``` { "formattedDebugInfo": string } ``` |

| Fields ||
|---|---|
| `formattedDebugInfo` | `string` General debug info formatted for display. |

## ErrorInfo

Error information about the response.

| JSON representation |
|---|
| ``` { "errorMessages": [ { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ErrorMessage`) } ] } ``` |

| Fields ||
|---|---|
| `errorMessages[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#ErrorMessage`)`` |

## ErrorMessage

Error message per source response.

| JSON representation |
|---|
| ``` { "source": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#Source`) }, "errorMessage": string } ``` |

| Fields ||
|---|---|
| `source` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#Source`)`` |
| `errorMessage` | `string` |

## ResultCounts

Result count information

| JSON representation |
|---|
| ``` { "sourceResultCounts": [ { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SourceResultCount`) } ] } ``` |

| Fields ||
|---|---|
| `sourceResultCounts[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/query/search#SourceResultCount`)`` Result count information for each source with results. |

## SourceResultCount

Per source result count information.

| JSON representation |
|---|
| ``` { "source": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#Source`) }, "hasMoreResults": boolean, "resultCountEstimate": string, "resultCountExact": string } ``` |

| Fields ||
|---|---|
| `source` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/settings.searchapplications#Source`)`` The source the result count information is associated with. |
| `hasMoreResults` | `boolean` Whether there are more search results for this source. |
| Union field `result_count`. `result_count` can be only one of the following: ||
| `resultCountEstimate` | `string (https://developers.google.com/discovery/v1/type-format format)` The estimated result count for this source. |
| `resultCountExact` | `string (https://developers.google.com/discovery/v1/type-format format)` The exact result count for this source. |