-
addOrUpdate - Index document
-
index - Index documents
-
bulkIndex - Bulk index documents
-
processAll - Schedules the processing of uploaded documents
-
delete - Delete document
-
debug - Beta: Get document information
-
debugMany - Beta: Get information of a batch of documents
-
checkAccess - Check document access
-
status- Get document upload and indexing status⚠️ Deprecated -
count- Get document count⚠️ Deprecated
Adds a document to the index or updates an existing document.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.DocumentDefinition;
import com.glean.api_client.glean_api_client.models.components.IndexDocumentRequest;
import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexdocumentResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
IndexDocumentRequest req = IndexDocumentRequest.builder()
.document(DocumentDefinition.builder()
.datasource("<value>")
.build())
.build();
PostApiIndexV1IndexdocumentResponse res = sdk.indexing().documents().addOrUpdate()
.request(req)
.call();
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
request |
IndexDocumentRequest | ✔️ | The request object to use for the request. |
PostApiIndexV1IndexdocumentResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/APIException | 4XX, 5XX | */* |
Adds or updates multiple documents in the index. Please refer to the bulk indexing documentation for an explanation of when to use this endpoint.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.IndexDocumentsRequest;
import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1IndexdocumentsResponse;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
IndexDocumentsRequest req = IndexDocumentsRequest.builder()
.datasource("<value>")
.documents(List.of())
.build();
PostApiIndexV1IndexdocumentsResponse res = sdk.indexing().documents().index()
.request(req)
.call();
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
request |
IndexDocumentsRequest | ✔️ | The request object to use for the request. |
PostApiIndexV1IndexdocumentsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/APIException | 4XX, 5XX | */* |
Replaces the documents in a datasource using paginated batch API calls. Please refer to the bulk indexing documentation for an explanation of how to use bulk endpoints.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.BulkIndexDocumentsRequest;
import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1BulkindexdocumentsResponse;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
BulkIndexDocumentsRequest req = BulkIndexDocumentsRequest.builder()
.uploadId("<id>")
.datasource("<value>")
.documents(List.of())
.build();
PostApiIndexV1BulkindexdocumentsResponse res = sdk.indexing().documents().bulkIndex()
.request(req)
.call();
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
request |
BulkIndexDocumentsRequest | ✔️ | The request object to use for the request. |
PostApiIndexV1BulkindexdocumentsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/APIException | 4XX, 5XX | */* |
Schedules the immediate processing of documents uploaded through the indexing API. By default the uploaded documents will be processed asynchronously but this API can be used to schedule processing of all documents on demand.
If a datasource parameter is specified, processing is limited to that custom datasource. Without it, processing applies to all documents across all custom datasources.
This endpoint is rate-limited to one usage every 3 hours. Exceeding this limit results in a 429 response code. Here's how the rate limit works:
- Calling
/processalldocumentsfor datasourcefooprevents another call forfoofor 3 hours. - Calling
/processalldocumentsfor datasourcefoodoesn't affect immediate calls forbar. - Calling
/processalldocumentsfor all datasources prevents any datasource calls for 3 hours. - Calling
/processalldocumentsfor datasourcefoodoesn't affect immediate calls for all datasources.
For more frequent document processing, contact Glean support.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1ProcessalldocumentsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
PostApiIndexV1ProcessalldocumentsResponse res = sdk.indexing().documents().processAll()
.call();
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
request |
ProcessAllDocumentsRequest | ✔️ | The request object to use for the request. |
PostApiIndexV1ProcessalldocumentsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/APIException | 4XX, 5XX | */* |
Deletes the specified document from the index. Succeeds if document is not present.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.DeleteDocumentRequest;
import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DeletedocumentResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
DeleteDocumentRequest req = DeleteDocumentRequest.builder()
.datasource("<value>")
.objectType("<value>")
.id("<id>")
.build();
PostApiIndexV1DeletedocumentResponse res = sdk.indexing().documents().delete()
.request(req)
.call();
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
request |
DeleteDocumentRequest | ✔️ | The request object to use for the request. |
PostApiIndexV1DeletedocumentResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/APIException | 4XX, 5XX | */* |
Gives various information that would help in debugging related to a particular document. Currently in beta, might undergo breaking changes without prior notice.
Tip: Refer to the Troubleshooting tutorial for more information.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.DebugDocumentRequest;
import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceDocumentResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
PostApiIndexV1DebugDatasourceDocumentResponse res = sdk.indexing().documents().debug()
.datasource("<value>")
.debugDocumentRequest(DebugDocumentRequest.builder()
.objectType("Article")
.docId("art123")
.build())
.call();
if (res.debugDocumentResponse().isPresent()) {
// handle response
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
datasource |
String | ✔️ | The datasource to which the document belongs |
debugDocumentRequest |
DebugDocumentRequest | ✔️ | N/A |
PostApiIndexV1DebugDatasourceDocumentResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/APIException | 4XX, 5XX | */* |
Gives various information that would help in debugging related to a batch of documents. Currently in beta, might undergo breaking changes without prior notice.
Tip: Refer to the Troubleshooting tutorial for more information.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.DebugDocumentRequest;
import com.glean.api_client.glean_api_client.models.components.DebugDocumentsRequest;
import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1DebugDatasourceDocumentsResponse;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
PostApiIndexV1DebugDatasourceDocumentsResponse res = sdk.indexing().documents().debugMany()
.datasource("<value>")
.debugDocumentsRequest(DebugDocumentsRequest.builder()
.debugDocuments(List.of(
DebugDocumentRequest.builder()
.objectType("Article")
.docId("art123")
.build()))
.build())
.call();
if (res.debugDocumentsResponse().isPresent()) {
// handle response
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
datasource |
String | ✔️ | The datasource to which the document belongs |
debugDocumentsRequest |
DebugDocumentsRequest | ✔️ | N/A |
PostApiIndexV1DebugDatasourceDocumentsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/APIException | 4XX, 5XX | */* |
Check if a given user has access to access a document in a custom datasource
Tip: Refer to the Troubleshooting tutorial for more information.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.CheckDocumentAccessRequest;
import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1CheckdocumentaccessResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
CheckDocumentAccessRequest req = CheckDocumentAccessRequest.builder()
.datasource("<value>")
.objectType("<value>")
.docId("<id>")
.userEmail("<value>")
.build();
PostApiIndexV1CheckdocumentaccessResponse res = sdk.indexing().documents().checkAccess()
.request(req)
.call();
if (res.checkDocumentAccessResponse().isPresent()) {
// handle response
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
request |
CheckDocumentAccessRequest | ✔️ | The request object to use for the request. |
PostApiIndexV1CheckdocumentaccessResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/APIException | 4XX, 5XX | */* |
Intended for debugging/validation. Fetches the current upload and indexing status of documents.
Tip: Use /debug/{datasource}/document for richer information.
⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.GetDocumentStatusRequest;
import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1GetdocumentstatusResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
GetDocumentStatusRequest req = GetDocumentStatusRequest.builder()
.datasource("<value>")
.objectType("<value>")
.docId("<id>")
.build();
PostApiIndexV1GetdocumentstatusResponse res = sdk.indexing().documents().status()
.request(req)
.call();
if (res.getDocumentStatusResponse().isPresent()) {
// handle response
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
request |
GetDocumentStatusRequest | ✔️ | The request object to use for the request. |
PostApiIndexV1GetdocumentstatusResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/APIException | 4XX, 5XX | */* |
Fetches document count for the specified custom datasource.
Tip: Use /debug/{datasource}/status for richer information.
⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.GetDocumentCountRequest;
import com.glean.api_client.glean_api_client.models.operations.PostApiIndexV1GetdocumentcountResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
GetDocumentCountRequest req = GetDocumentCountRequest.builder()
.datasource("<value>")
.build();
PostApiIndexV1GetdocumentcountResponse res = sdk.indexing().documents().count()
.request(req)
.call();
if (res.getDocumentCountResponse().isPresent()) {
// handle response
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
request |
GetDocumentCountRequest | ✔️ | The request object to use for the request. |
PostApiIndexV1GetdocumentcountResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/APIException | 4XX, 5XX | */* |