- upsert - Add or update custom metadata
- delete - Remove custom metadata
- getSchema - Retrieve metadata schema
- upsertSchema - Create or update metadata schema
- deleteSchema - Remove metadata schema
Associates custom metadata with a specific document. Custom metadata enables you to enrich documents with additional structured information that can be used for search, filtering, and faceting.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.CustomMetadataPutRequest;
import com.glean.api_client.glean_api_client.models.errors.ErrorInfoResponse;
import com.glean.api_client.glean_api_client.models.operations.PutRestApiIndexDocumentDocIdCustomMetadataGroupNameResponse;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws ErrorInfoResponse, Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
PutRestApiIndexDocumentDocIdCustomMetadataGroupNameResponse res = sdk.indexing().customMetadata().upsert()
.docId("<id>")
.groupName("<value>")
.customMetadataPutRequest(CustomMetadataPutRequest.builder()
.customMetadata(List.of())
.build())
.call();
if (res.successResponse().isPresent()) {
System.out.println(res.successResponse().get());
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
docId |
String | ✔️ | Unique Glean identifier of the document |
groupName |
String | ✔️ | Name of the metadata group as specified while adding schema |
customMetadataPutRequest |
CustomMetadataPutRequest | ✔️ | N/A |
serverURL |
String | ➖ | An optional server URL to use. |
PutRestApiIndexDocumentDocIdCustomMetadataGroupNameResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/ErrorInfoResponse | 400, 401, 404, 429 | application/json |
| models/errors/ErrorInfoResponse | 500 | application/json |
| models/errors/APIException | 4XX, 5XX | */* |
Removes all custom metadata for the specified metadata group from a document.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.errors.ErrorInfoResponse;
import com.glean.api_client.glean_api_client.models.operations.DeleteRestApiIndexDocumentDocIdCustomMetadataGroupNameResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ErrorInfoResponse, Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
DeleteRestApiIndexDocumentDocIdCustomMetadataGroupNameResponse res = sdk.indexing().customMetadata().delete()
.docId("<id>")
.groupName("<value>")
.call();
if (res.successResponse().isPresent()) {
System.out.println(res.successResponse().get());
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
docId |
String | ✔️ | Unique Glean identifier of the document |
groupName |
String | ✔️ | Name of the metadata group as specified while adding schema |
serverURL |
String | ➖ | An optional server URL to use. |
DeleteRestApiIndexDocumentDocIdCustomMetadataGroupNameResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/ErrorInfoResponse | 400, 401, 404, 429 | application/json |
| models/errors/ErrorInfoResponse | 500 | application/json |
| models/errors/APIException | 4XX, 5XX | */* |
Retrieves the current schema definition for a metadata group.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.errors.ErrorInfoResponse;
import com.glean.api_client.glean_api_client.models.operations.GetRestApiIndexCustomMetadataSchemaGroupNameResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ErrorInfoResponse, Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
GetRestApiIndexCustomMetadataSchemaGroupNameResponse res = sdk.indexing().customMetadata().getSchema()
.groupName("<value>")
.call();
if (res.customMetadataSchema().isPresent()) {
System.out.println(res.customMetadataSchema().get());
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
groupName |
String | ✔️ | Name of the metadata group schema |
serverURL |
String | ➖ | An optional server URL to use. |
GetRestApiIndexCustomMetadataSchemaGroupNameResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/ErrorInfoResponse | 401, 404, 429 | application/json |
| models/errors/ErrorInfoResponse | 500 | application/json |
| models/errors/APIException | 4XX, 5XX | */* |
Defines or updates the schema for a metadata group. Schemas should be defined before indexing metadata.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.CustomMetadataSchema;
import com.glean.api_client.glean_api_client.models.errors.ErrorInfoResponse;
import com.glean.api_client.glean_api_client.models.operations.PutRestApiIndexCustomMetadataSchemaGroupNameResponse;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws ErrorInfoResponse, Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
PutRestApiIndexCustomMetadataSchemaGroupNameResponse res = sdk.indexing().customMetadata().upsertSchema()
.groupName("<value>")
.customMetadataSchema(CustomMetadataSchema.builder()
.metadataKeys(List.of())
.build())
.call();
if (res.successResponse().isPresent()) {
System.out.println(res.successResponse().get());
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
groupName |
String | ✔️ | Name of the metadata group schema |
customMetadataSchema |
CustomMetadataSchema | ✔️ | N/A |
serverURL |
String | ➖ | An optional server URL to use. |
PutRestApiIndexCustomMetadataSchemaGroupNameResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/ErrorInfoResponse | 400, 401, 409, 429 | application/json |
| models/errors/ErrorInfoResponse | 500 | application/json |
| models/errors/APIException | 4XX, 5XX | */* |
Deletes the schema definition for a metadata group. This does not delete existing metadata values on documents.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.errors.ErrorInfoResponse;
import com.glean.api_client.glean_api_client.models.operations.DeleteRestApiIndexCustomMetadataSchemaGroupNameResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ErrorInfoResponse, Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
DeleteRestApiIndexCustomMetadataSchemaGroupNameResponse res = sdk.indexing().customMetadata().deleteSchema()
.groupName("<value>")
.call();
if (res.successResponse().isPresent()) {
System.out.println(res.successResponse().get());
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
groupName |
String | ✔️ | Name of the metadata group schema |
serverURL |
String | ➖ | An optional server URL to use. |
DeleteRestApiIndexCustomMetadataSchemaGroupNameResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/ErrorInfoResponse | 400, 401, 404, 429 | application/json |
| models/errors/ErrorInfoResponse | 500 | application/json |
| models/errors/APIException | 4XX, 5XX | */* |