REST Resource: projects.locations.collections.dataStores.schemas

Resource: Schema

Defines the structure and layout of a type of document data.

JSON representation
{
  "name": string,
  "fieldConfigs": [
    {
      object (FieldConfig)
    }
  ],

  // Union field schema can be only one of the following:
  "structSchema": {
    object
  },
  "jsonSchema": string
  // End of list of possible types for union field schema.
}
Fields
name

string

Immutable. The full resource name of the schema, in the format of projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}/schemas/{schema}.

This field must be a UTF-8 encoded string with a length limit of 1024 characters.

fieldConfigs[]

object (FieldConfig)

Output only. Configurations for fields of the schema.

Union field schema. Schema representation. One of struct_schema or json_schema should be provided otherwise an INVALID_ARGUMENT error is thrown. schema can be only one of the following:
structSchema

object (Struct format)

The structured representation of the schema.

jsonSchema

string

The JSON representation of the schema.

FieldConfig

Configurations for fields of a schema. For example, configuring a field is indexable, or searchable.

JSON representation
{
  "fieldPath": string,
  "fieldType": enum (FieldType),
  "indexableOption": enum (IndexableOption),
  "dynamicFacetableOption": enum (DynamicFacetableOption),
  "searchableOption": enum (SearchableOption),
  "retrievableOption": enum (RetrievableOption),
  "completableOption": enum (CompletableOption),
  "recsFilterableOption": enum (FilterableOption),
  "keyPropertyType": string,
  "advancedSiteSearchDataSources": [
    enum (AdvancedSiteSearchDataSource)
  ]
}
Fields
fieldPath

string

Required. Field path of the schema field. For example: title, description, release_info.release_year.

fieldType

enum (FieldType)

Output only. Raw type of the field.

indexableOption

enum (IndexableOption)

If indexableOption is INDEXABLE_ENABLED, field values are indexed so that it can be filtered or faceted in SearchService.Search.

If indexableOption is unset, the server behavior defaults to INDEXABLE_DISABLED for fields that support setting indexable options. For those fields that do not support setting indexable options, such as object and boolean and key properties, the server will skip indexableOption setting, and setting indexableOption for those fields will throw INVALID_ARGUMENT error.

dynamicFacetableOption

enum (DynamicFacetableOption)

If dynamicFacetableOption is DYNAMIC_FACETABLE_ENABLED, field values are available for dynamic facet. Could only be DYNAMIC_FACETABLE_DISABLED if FieldConfig.indexable_option is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error will be returned.

If dynamicFacetableOption is unset, the server behavior defaults to DYNAMIC_FACETABLE_DISABLED for fields that support setting dynamic facetable options. For those fields that do not support setting dynamic facetable options, such as object and boolean, the server will skip dynamic facetable option setting, and setting dynamicFacetableOption for those fields will throw INVALID_ARGUMENT error.

searchableOption

enum (SearchableOption)

If searchableOption is SEARCHABLE_ENABLED, field values are searchable by text queries in SearchService.Search.

If SEARCHABLE_ENABLED but field type is numerical, field values will not be searchable by text queries in SearchService.Search, as there are no text values associated to numerical fields.

If searchableOption is unset, the server behavior defaults to SEARCHABLE_DISABLED for fields that support setting searchable options. Only string fields that have no key property mapping support setting searchableOption.

For those fields that do not support setting searchable options, the server will skip searchable option setting, and setting searchableOption for those fields will throw INVALID_ARGUMENT error.

retrievableOption

enum (RetrievableOption)

If retrievableOption is RETRIEVABLE_ENABLED, field values are included in the search results.

If retrievableOption is unset, the server behavior defaults to RETRIEVABLE_DISABLED for fields that support setting retrievable options. For those fields that do not support setting retrievable options, such as object and boolean, the server will skip retrievable option setting, and setting retrievableOption for those fields will throw INVALID_ARGUMENT error.

completableOption

enum (CompletableOption)

If completableOption is COMPLETABLE_ENABLED, field values are directly used and returned as suggestions for Autocomplete in CompletionService.CompleteQuery.

If completableOption is unset, the server behavior defaults to COMPLETABLE_DISABLED for fields that support setting completable options, which are just string fields. For those fields that do not support setting completable options, the server will skip completable option setting, and setting completableOption for those fields will throw INVALID_ARGUMENT error.

recsFilterableOption

enum (FilterableOption)

If recsFilterableOption is FILTERABLE_ENABLED, field values are filterable by filter expression in RecommendationService.Recommend.

If FILTERABLE_ENABLED but the field type is numerical, field values are not filterable by text queries in RecommendationService.Recommend. Only textual fields are supported.

If recsFilterableOption is unset, the default setting is FILTERABLE_DISABLED for fields that support setting filterable options.

When a field set to [FILTERABLE_DISABLED] is filtered, a warning is generated and an empty result is returned.

keyPropertyType

string

Output only. Type of the key property that this field is mapped to. Empty string if this is not annotated as mapped to a key property.

Example types are title, description. Full list is defined by keyPropertyMapping in the schema field annotation.

If the schema field has a KeyPropertyMapping annotation, indexableOption and searchableOption of this field cannot be modified.

advancedSiteSearchDataSources[]

enum (AdvancedSiteSearchDataSource)

If this field is set, only the corresponding source will be indexed for this field. Otherwise, the values from different sources are merged.

Assuming a page with <author, a> in meta tag, and <author, b> in page map: if this enum is set to METATAGS, we will only index <author, a>; if this enum is not set, we will merge them and index <author, [a, b]>.

FieldType

Field value type in the Schema.

Enums
FIELD_TYPE_UNSPECIFIED Field type is unspecified.
OBJECT Field value type is Object.
STRING Field value type is String.
NUMBER Field value type is Number.
INTEGER Field value type is Integer.
BOOLEAN Field value type is Boolean.
GEOLOCATION

Field value type is Geolocation. Geolocation is expressed as an object with the following keys:

  • id: a string representing the location id
  • longitude: a number representing the longitude coordinate of the location
  • latitude: a number repesenting the latitude coordinate of the location
  • address: a string representing the full address of the location

latitude and longitude must always be provided together. At least one of a) address or b) latitude-longitude pair must be provided.

DATETIME

Field value type is Datetime. Datetime can be expressed as either:

  • a number representing milliseconds-since-the-epoch
  • a string representing milliseconds-since-the-epoch. e.g. "1420070400001"
  • a string representing the ISO 8601 date or date and time. e.g. "2015-01-01" or "2015-01-01T12:10:30Z"

IndexableOption

The setting of Indexable options in schema.

Enums
INDEXABLE_OPTION_UNSPECIFIED Value used when unset.
INDEXABLE_ENABLED Indexable option enabled for a schema field.
INDEXABLE_DISABLED Indexable option disabled for a schema field.

DynamicFacetableOption

The status of the dynamic facetable option of a schema field.

Enums
DYNAMIC_FACETABLE_OPTION_UNSPECIFIED Value used when unset.
DYNAMIC_FACETABLE_ENABLED Dynamic facetable option enabled for a schema field.
DYNAMIC_FACETABLE_DISABLED Dynamic facetable option disabled for a schema field.

SearchableOption

The setting of Searchable options in schema.

Enums
SEARCHABLE_OPTION_UNSPECIFIED Value used when unset.
SEARCHABLE_ENABLED Searchable option enabled for a schema field.
SEARCHABLE_DISABLED Searchable option disabled for a schema field.

RetrievableOption

The setting of Retrievable options in schema.

Enums
RETRIEVABLE_OPTION_UNSPECIFIED Value used when unset.
RETRIEVABLE_ENABLED Retrievable option enabled for a schema field.
RETRIEVABLE_DISABLED Retrievable option disabled for a schema field.

CompletableOption

The setting of Completable options in schema.

Enums
COMPLETABLE_OPTION_UNSPECIFIED Value used when unset.
COMPLETABLE_ENABLED Completable option enabled for a schema field.
COMPLETABLE_DISABLED Completable option disabled for a schema field.

FilterableOption

Sets the filterable option for schema fields.

Enums
FILTERABLE_OPTION_UNSPECIFIED Value used when unset.
FILTERABLE_ENABLED Filterable option enabled for a schema field.
FILTERABLE_DISABLED Filterable option disabled for a schema field.

AdvancedSiteSearchDataSource

Optional source of the advanced site search field.

Enums
ADVANCED_SITE_SEARCH_DATA_SOURCE_UNSPECIFIED Value used when unset.
METATAGS Retrieve value from meta tag.
PAGEMAP Retrieve value from page map.

Methods

create

Creates a Schema.

delete

Deletes a Schema.

get

Gets a Schema.

list

Gets a list of Schemas.

patch

Updates a Schema.