Class IndexAdminResource
Blocking gRPC stub on virtual threads — no Mutiny.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponsecreateIndex(Map<String, Object> payload) Creates a kNN vector index.jakarta.ws.rs.core.ResponsedeleteIndex(String indexName, boolean force) Deletes a single index.jakarta.ws.rs.core.ResponsedeprovisionIndex(Map<String, Object> payload) Tears down a previously-provisioned index set: deletes the parent index plus every index whose name starts withindexName + "--"(the OSM convention for--chunk--…and--vs--…side indices).jakarta.ws.rs.core.ResponsegetDocument(String indexName, String documentId) Fetches a single stored document by index and document id.jakarta.ws.rs.core.ResponsegetIndexMapping(String indexName) Returns the field mapping of the named index as JSON.jakarta.ws.rs.core.ResponsegetIndexStats(String indexName) Returns document-count and size statistics for a single index.jakarta.ws.rs.core.ResponseindexExists(String indexName) Reports whether the named index exists.jakarta.ws.rs.core.ResponselistIndices(String prefix) Lists OpenSearch indices, optionally filtered by name prefix.jakarta.ws.rs.core.ResponseprovisionIndex(Map<String, Object> payload) Pre-provisions a fresh parent index plus every--chunk--/--vs--side index required by the supplied SemanticConfigs, and populates thevector_set_index_bindingcache.
-
Constructor Details
-
IndexAdminResource
public IndexAdminResource()Creates the index administration resource. Instances are managed by the JAX-RS runtime.
-
-
Method Details
-
listIndices
Lists OpenSearch indices, optionally filtered by name prefix.Each returned entry carries the index name, document count, size in bytes, status, and (when present) a list of its vector-field summaries.
- Parameters:
prefix- optional prefix filter; when null or blank, all indices are listed- Returns:
- a
200JSON response withindicesandcount, or an error response
-
getIndexStats
@GET @Path("/{indexName}/stats") public jakarta.ws.rs.core.Response getIndexStats(@PathParam("indexName") String indexName) Returns document-count and size statistics for a single index.- Parameters:
indexName- the index to inspect- Returns:
- a
200JSON response withsuccess,documentCount,sizeInBytes, andmessage, or an error response
-
indexExists
@GET @Path("/{indexName}/exists") public jakarta.ws.rs.core.Response indexExists(@PathParam("indexName") String indexName) Reports whether the named index exists.- Parameters:
indexName- the index to check- Returns:
- a
200JSON response withindexNameandexists, or an error response
-
getIndexMapping
@GET @Path("/{indexName}/mapping") public jakarta.ws.rs.core.Response getIndexMapping(@PathParam("indexName") String indexName) Returns the field mapping of the named index as JSON.The protobuf mapping struct is rendered to JSON and parsed back into a map for the response. A serialization failure is logged and reported as a
500.- Parameters:
indexName- the index whose mapping is requested- Returns:
- a
200JSON response withindexNameandmappings, a500on serialization failure, or an error response
-
createIndex
Creates a kNN vector index.The request body must supply
indexNameanddimensions(there is no default for dimensions);fieldNameis optional and defaults toembeddings. Missing required fields yield a400.- Parameters:
payload- request body withindexName,dimensions, and optionalfieldName- Returns:
- a
200JSON response describing the created index, a400on missing required fields, or an error response
-
provisionIndex
@POST @Path("/provision") public jakarta.ws.rs.core.Response provisionIndex(Map<String, Object> payload) Pre-provisions a fresh parent index plus every--chunk--/--vs--side index required by the supplied SemanticConfigs, and populates thevector_set_index_bindingcache. After this call returnssuccess=true, documents indexed intoindexNametake the cached fast path — no per-doc DB writes or cluster-state round-trips.This is the stress-test-friendly setup step: call it once with a scratch index name before firing a stress run that targets opensearch-sink, then use
deprovisionIndex(Map)to tear down when the run is complete.Idempotent. Safe to re-invoke with the same inputs.
Request body:
{ "indexName": "...", "semanticConfigIds": [...] }Response body:
success, indicesCreated[], bindingsProvisioned, message- Parameters:
payload- request body withindexNameand optionalsemanticConfigIds- Returns:
- provisioning outcome
-
deprovisionIndex
@POST @Path("/deprovision") public jakarta.ws.rs.core.Response deprovisionIndex(Map<String, Object> payload) Tears down a previously-provisioned index set: deletes the parent index plus every index whose name starts withindexName + "--"(the OSM convention for--chunk--…and--vs--…side indices). Composed from the existingListIndices+DeleteIndexRPCs — OSM does not yet have a matchedDeprovisionIndexcounterpart, so this is a best-effort loop that keeps going past individual failures and reports what it did.Binding rows (
vector_set_index_binding) are not dropped here — only the OpenSearch indices. Binding cleanup still requires direct DB surgery until OSM shipsRemoveSemanticBinding(TODO in OpenSearchManagerService).Same safety fence as
deleteIndex(String, boolean): refuses to operate on indices outsidetest-pipeline-*/pipeline-*/test-*prefixes unlessforce=true.- Parameters:
payload- request body withindexNameand optionalforce- Returns:
- deprovisioning outcome (requested / deleted / failures)
-
deleteIndex
@DELETE @Path("/{indexName}") public jakarta.ws.rs.core.Response deleteIndex(@PathParam("indexName") String indexName, @QueryParam("force") @DefaultValue("false") boolean force) Deletes a single index.Unless
forceis set, onlytest-pipeline-*andpipeline-*indices may be deleted; other names are rejected with a403.- Parameters:
indexName- the index to deleteforce- whentrue, bypasses the test-prefix safety restriction- Returns:
- a
200JSON response with the deletion outcome, a403when the safety restriction blocks the request, or an error response
-
getDocument
@GET @Path("/{indexName}/documents/{documentId}") public jakarta.ws.rs.core.Response getDocument(@PathParam("indexName") String indexName, @PathParam("documentId") String documentId) Fetches a single stored document by index and document id.When the document is not found a
404is returned; otherwise the stored document is rendered to JSON (preserving proto field names) and returned.- Parameters:
indexName- the index to read fromdocumentId- the id of the document to fetch- Returns:
- a
200JSON document when found, a404when not found, a500on serialization failure, or an error response
-