# REST Resource: projects.locations.corpora.searchConfigs

- [Resource: SearchConfig](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#SearchConfig)
  - [JSON representation](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#SearchConfig.SCHEMA_REPRESENTATION)
- [FacetProperty](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FacetProperty)
  - [JSON representation](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FacetProperty.SCHEMA_REPRESENTATION)
- [FixedRangeBucketSpec](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FixedRangeBucketSpec)
  - [JSON representation](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FixedRangeBucketSpec.SCHEMA_REPRESENTATION)
- [FacetValue](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FacetValue)
  - [JSON representation](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FacetValue.SCHEMA_REPRESENTATION)
- [CustomRangeBucketSpec](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#CustomRangeBucketSpec)
  - [JSON representation](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#CustomRangeBucketSpec.SCHEMA_REPRESENTATION)
- [DateTimeBucketSpec](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#DateTimeBucketSpec)
  - [JSON representation](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#DateTimeBucketSpec.SCHEMA_REPRESENTATION)
- [Granularity](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#Granularity)
- [FacetBucketType](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FacetBucketType)
- [SearchCriteriaProperty](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#SearchCriteriaProperty)
  - [JSON representation](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#SearchCriteriaProperty.SCHEMA_REPRESENTATION)
- [Methods](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#METHODS_SUMMARY)

## Resource: SearchConfig

SearchConfig stores different properties that will affect search behaviors and search results.

| JSON representation |
|---|
| ``` { "name": string, "facetProperty": { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FacetProperty`) }, "searchCriteriaProperty": { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#SearchCriteriaProperty`) } } ``` |

| Fields ||
|---|---|
| `name` | `string` Resource name of the search configuration. For CustomSearchCriteria, searchConfig would be the search operator name. For Facets, searchConfig would be the facet dimension name. Form: `projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{searchConfig}` |
| `facetProperty` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FacetProperty`)`` Establishes a FacetDimension and associated specifications. |
| `searchCriteriaProperty` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#SearchCriteriaProperty`)`` Creates a mapping between a custom SearchCriteria and one or more UGA keys. |

## FacetProperty

Central configuration for a facet.

| JSON representation |
|---|
| ``` { "mappedFields": [ string ], "displayName": string, "resultSize": string, "bucketType": enum (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FacetBucketType`), // Union field `range_facet_config` can be only one of the following: "fixedRangeBucketSpec": { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FixedRangeBucketSpec`) }, "customRangeBucketSpec": { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#CustomRangeBucketSpec`) }, "datetimeBucketSpec": { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#DateTimeBucketSpec`) } // End of list of possible types for union field `range_facet_config`. } ``` |

| Fields ||
|---|---|
| `mappedFields[]` | `string` Name of the facets, which are the dimensions users want to use to refine search results. `mappedFields` will match UserSpecifiedDataSchema keys. For example, user can add a bunch of UGAs with the same key, such as player:adam, player:bob, player:charles. When multiple mappedFields are specified, will merge their value together as final facet value. E.g. home_team: a, home_team:b, away_team:a, away_team:c, when facet_field = \[home_team, away_team\], facet_value will be \[a, b, c\]. UNLESS this is a 1:1 facet dimension (mappedFields.size() == 1) AND the mapped_field equals the parent SearchConfig.name, the parent must also contain a SearchCriteriaProperty that maps to the same fields. mappedFields must not be empty. |
| `displayName` | `string` Display name of the facet. To be used by UI for facet rendering. |
| `resultSize` | `string (https://developers.google.com/discovery/v1/type-format format)` Maximum number of unique bucket to return for one facet. Bucket number can be large for high-cardinality facet such as "player". We only return top-n most related ones to user. If it's \<= 0, the server will decide the appropriate resultSize. |
| `bucketType` | ``enum (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FacetBucketType`)`` Facet bucket type e.g. value, range. |
| Union field `range_facet_config`. `range_facet_config` can be only one of the following: ||
| `fixedRangeBucketSpec` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FixedRangeBucketSpec`)`` Fixed range facet bucket config. |
| `customRangeBucketSpec` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#CustomRangeBucketSpec`)`` Custom range facet bucket config. |
| `datetimeBucketSpec` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#DateTimeBucketSpec`)`` Datetime range facet bucket config. |

## FixedRangeBucketSpec

If bucket type is FIXED_RANGE, specify how values are bucketized. Use FixedRangeBucketSpec when you want to create multiple buckets with equal granularities. Using integer bucket value as an example, when bucketStart = 0, bucketGranularity = 10, bucketCount = 5, this facet will be aggregated via the following buckets: \[-inf, 0), \[0, 10), \[10, 20), \[20, 30), \[30, inf). Notably, bucketCount \<= 1 is an invalid spec.

| JSON representation |
|---|
| ``` { "bucketStart": { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FacetValue`) }, "bucketGranularity": { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FacetValue`) }, "bucketCount": integer } ``` |

| Fields ||
|---|---|
| `bucketStart` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FacetValue`)`` Lower bound of the bucket. NOTE: Only integer type is currently supported for this field. |
| `bucketGranularity` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FacetValue`)`` Bucket granularity. NOTE: Only integer type is currently supported for this field. |
| `bucketCount` | `integer` Total number of buckets. |

## FacetValue

Definition of a single value with generic type.

| JSON representation |
|---|
| ``` { // Union field `value` can be only one of the following: "stringValue": string, "integerValue": string, "datetimeValue": { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/Shared.Types/DateTime`) } // End of list of possible types for union field `value`. } ``` |

| Fields ||
|---|---|
| Union field `value`. `value` can be only one of the following: ||
| `stringValue` | `string` String type value. |
| `integerValue` | `string (https://developers.google.com/discovery/v1/type-format format)` Integer type value. |
| `datetimeValue` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/Shared.Types/DateTime`)`` Datetime type value. |

## CustomRangeBucketSpec

If bucket type is CUSTOM_RANGE, specify how values are bucketized. Use integer bucket value as an example, when the endpoints are 0, 10, 100, and 1000, we will generate the following facets: \[-inf, 0), \[0, 10), \[10, 100), \[100, 1000), \[1000, inf). Notably: - endpoints must be listed in ascending order. Otherwise, the SearchConfig API will reject the facet config. - \< 1 endpoints is an invalid spec.

| JSON representation |
|---|
| ``` { "endpoints": [ { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FacetValue`) } ] } ``` |

| Fields ||
|---|---|
| `endpoints[]` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#FacetValue`)`` Currently, only integer type is supported for this field. |

## DateTimeBucketSpec

If bucket type is DATE, specify how date values are bucketized.

| JSON representation |
|---|
| ``` { "granularity": enum (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#Granularity`) } ``` |

| Fields ||
|---|---|
| `granularity` | ``enum (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs#Granularity`)`` Granularity of date type facet. |

## Granularity

Granularity enum for the datetime bucket.

| Enums ||
|---|---|
| `GRANULARITY_UNSPECIFIED` | Unspecified granularity. |
| `YEAR` | Granularity is year. |
| `MONTH` | Granularity is month. |
| `DAY` | Granularity is day. |

## FacetBucketType

Different types for a facet bucket.

| Enums ||
|---|---|
| `FACET_BUCKET_TYPE_UNSPECIFIED` | Unspecified type. |
| `FACET_BUCKET_TYPE_VALUE` | Value type. |
| `FACET_BUCKET_TYPE_DATETIME` | Datetime type. |
| `FACET_BUCKET_TYPE_FIXED_RANGE` | Fixed Range type. |
| `FACET_BUCKET_TYPE_CUSTOM_RANGE` | Custom Range type. |

## SearchCriteriaProperty

Central configuration for custom search criteria.

| JSON representation |
|---|
| ``` { "mappedFields": [ string ] } ``` |

| Fields ||
|---|---|
| `mappedFields[]` | `string` Each mapped_field corresponds to a UGA key. To understand how this property works, take the following example. In the SearchConfig table, the user adds this entry: searchConfig { name: "person" searchCriteriaProperty { mappedFields: "player" mappedFields: "coach" } } Now, when a user issues a query like: criteria { field: "person" textArray { txtValues: "Tom Brady" txtValues: "Bill Belichick" } } MWH search will return search documents where (player=Tom Brady \|\| coach=Tom Brady \|\| player=Bill Belichick \|\| coach=Bill Belichick). |

| ## Methods ||
|---|---|
| ### `https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs/create` | Creates a search configuration inside a corpus. |
| ### `https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs/delete` | Deletes a search configuration inside a corpus. |
| ### `https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs/get` | Gets a search configuration inside a corpus. |
| ### `https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs/list` | Lists all search configurations inside a corpus. |
| ### `https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.corpora.searchConfigs/patch` | Updates a search configuration inside a corpus. |