Class Schema (5.0.3)
Stay organized with collections
Save and categorize content based on your preferences.
public final class Schema
Contains information about the kinds of document Fields
which are supported by the Index.
// Get the searchService for the default namespace
SearchService searchService = SearchServiceFactory.getSearchService();
// Get the first page of indexes available and retrieve schemas
GetResponse<Index> response = searchService.getIndexes(
GetIndexesRequest.newBuilder().setSchemaFetched(true).build());
// List out elements of Schema
for (Index index : response) {
Schema schema = index.getSchema();
for (String fieldName : schema.getFieldNames()) {
List<FieldType> typesForField = schema.getFieldTypes(fieldName);
}
}
Static Methods
newBuilder()
public static Schema.Builder newBuilder()
Creates a schema builder.
| Returns |
| Type |
Description |
Schema.Builder |
a new builder for creating a schema
|
Methods
equals(Object obj)
public boolean equals(Object obj)
| Parameter |
| Name |
Description |
obj |
Object
|
Overrides
getFieldNames()
public Set<String> getFieldNames()
| Returns |
| Type |
Description |
Set<String> |
the set of field names supported in the schema
|
getFieldTypes(String fieldName)
public List<Field.FieldType> getFieldTypes(String fieldName)
| Parameter |
| Name |
Description |
fieldName |
String
the name of the field to return supported types
|
| Returns |
| Type |
Description |
List<FieldType> |
a list of Field.FieldType supported for the given field
name. The returned list will be empty if the schema has no field with the given name.
|
hashCode()
| Returns |
| Type |
Description |
int |
|
Overrides
toString()
| Returns |
| Type |
Description |
String |
|
Overrides
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-06-03 UTC.
[null,null,["Last updated 2026-06-03 UTC."],[],[]]