Package com.dtsx.astra.sdk
Class AstraDBCollection
java.lang.Object
com.dtsx.astra.sdk.AstraDBCollection
Client for AstraDB at collection level (crud for documents).
-
Method Summary
Modifier and TypeMethodDescriptionCount Document request.countDocuments
(io.stargate.sdk.data.domain.query.Filter jsonFilter) Count Document request.int
Clear the collection.int
deleteById
(String id) Delete single record from its id.int
deleteByVector
(float[] vector) Delete single record from its vector.int
deleteMany
(io.stargate.sdk.data.domain.query.DeleteQuery deleteQuery) Delete multiple records from a request.int
deleteOne
(io.stargate.sdk.data.domain.query.DeleteQuery deleteQuery) Delete single record from a request.void
Set this options during insertMany: {"ordered": false}.void
Set this options during insertMany: {"ordered": true}.Stream
<io.stargate.sdk.data.domain.JsonDocumentResult> find
(io.stargate.sdk.data.domain.query.SelectQuery query) Search records with a filter<DOC> Stream
<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> find
(io.stargate.sdk.data.domain.query.SelectQuery query, io.stargate.sdk.data.domain.odm.DocumentResultMapper<DOC> mapper) Search records with a filter<DOC> Stream
<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> Search records with a filterStream
<io.stargate.sdk.data.domain.JsonDocumentResult> findAll()
Get all items in a collection.<DOC> Stream
<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> findAll
(io.stargate.sdk.data.domain.odm.DocumentResultMapper<DOC> mapper) Find All with Object Mapping.<DOC> Stream
<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> Find All with Object Mapping.<DOC> Optional
<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> Find document from its id.<DOC> Optional
<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> Find document from its id.Optional
<io.stargate.sdk.data.domain.JsonDocumentResult> Find document from its id.Optional
<io.stargate.sdk.data.domain.JsonDocumentResult> findOne
(io.stargate.sdk.data.domain.query.SelectQuery query) Find one document matching the query.<DOC> Optional
<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> findOne
(io.stargate.sdk.data.domain.query.SelectQuery query, io.stargate.sdk.data.domain.odm.DocumentResultMapper<DOC> mapper) Find one document matching the query.<DOC> Optional
<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> Find one document matching the query.Optional
<io.stargate.sdk.data.domain.JsonDocumentResult> Find one document matching the query.<DOC> Optional
<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> Find one document matching the query.<DOC> Optional
<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> Find one document matching the query.io.stargate.sdk.data.domain.JsonResultUpdate
findOneAndDelete
(io.stargate.sdk.data.domain.query.UpdateQuery query) Find ana delete a record based on a query.io.stargate.sdk.data.domain.JsonResultUpdate
findOneAndReplace
(io.stargate.sdk.data.domain.query.UpdateQuery query) Find ana replace a record based on a query,io.stargate.sdk.data.domain.JsonResultUpdate
findOneAndUpdate
(io.stargate.sdk.data.domain.query.UpdateQuery query) Find ana update a record based on a query,Optional
<io.stargate.sdk.data.domain.JsonDocumentResult> findOneByVector
(float[] vector) Find document from its vector.<DOC> Optional
<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> findOneByVector
(float[] vector, io.stargate.sdk.data.domain.odm.DocumentResultMapper<DOC> mapper) Find document from its vector.<DOC> Optional
<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> findOneByVector
(float[] vector, Class<DOC> clazz) Find document from its vector.io.stargate.sdk.core.domain.Page
<io.stargate.sdk.data.domain.JsonDocumentResult> findPage
(io.stargate.sdk.data.domain.query.SelectQuery pagedQuery) Find documents matching the pagedQuery.<T> io.stargate.sdk.core.domain.Page
<io.stargate.sdk.data.domain.odm.DocumentResult<T>> Find documents matching the query.io.stargate.sdk.core.domain.Page
<io.stargate.sdk.data.domain.JsonDocumentResult> Find documents matching the pagedQuery.io.stargate.sdk.core.domain.Page
<io.stargate.sdk.data.domain.JsonDocumentResult> findPageVector
(io.stargate.sdk.data.domain.query.SelectQuery query) Query builder.Stream
<io.stargate.sdk.data.domain.JsonDocumentResult> findVector
(float[] vector) Retrieve documents from a vector.<T> Stream
<io.stargate.sdk.data.domain.odm.DocumentResult<T>> findVector
(float[] vector, io.stargate.sdk.data.domain.odm.DocumentResultMapper<T> mapper) Retrieve documents from a vector.Stream
<io.stargate.sdk.data.domain.JsonDocumentResult> findVector
(float[] vector, io.stargate.sdk.data.domain.query.Filter filter, int recordCount) Retrieve documents from a vector.Stream
<io.stargate.sdk.data.domain.JsonDocumentResult> findVector
(float[] vector, io.stargate.sdk.data.domain.query.Filter filter, Integer limit) Query builder.Stream
<io.stargate.sdk.data.domain.JsonDocumentResult> findVector
(float[] vector, io.stargate.sdk.data.domain.query.Filter filter, Integer limit, boolean includeSimilarity) Query builder.<T> Stream
<io.stargate.sdk.data.domain.odm.DocumentResult<T>> findVector
(float[] vector, Class<T> clazz) Retrieve documents from a vector.Stream
<io.stargate.sdk.data.domain.JsonDocumentResult> findVector
(float[] vector, Integer limit) Query builder.Stream
<io.stargate.sdk.data.domain.JsonDocumentResult> findVector
(io.stargate.sdk.data.domain.query.SelectQuery query) Full-fledged search with a filter and conditions.<T> Stream
<io.stargate.sdk.data.domain.odm.DocumentResult<T>> findVector
(io.stargate.sdk.data.domain.query.SelectQuery query, io.stargate.sdk.data.domain.odm.DocumentResultMapper<T> mapper) Full-fledged search with a filter and conditions.<T> Stream
<io.stargate.sdk.data.domain.odm.DocumentResult<T>> findVector
(io.stargate.sdk.data.domain.query.SelectQuery query, Class<T> clazz) Full-fledged search with a filter and conditions.io.stargate.sdk.core.domain.Page
<io.stargate.sdk.data.domain.JsonDocumentResult> findVectorPage
(float[] vector, io.stargate.sdk.data.domain.query.Filter filter, Integer limit, String pagingState) Query builder.<DOC> io.stargate.sdk.core.domain.Page
<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> findVectorPage
(float[] vector, io.stargate.sdk.data.domain.query.Filter filter, Integer limit, String pagingState, io.stargate.sdk.data.domain.odm.DocumentResultMapper<DOC> mapper) Search similarity from the vector (page by 20)<DOC> io.stargate.sdk.core.domain.Page
<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> findVectorPage
(float[] vector, io.stargate.sdk.data.domain.query.Filter filter, Integer limit, String pagingState, Class<DOC> clazz) Search similarity from the vector (page by 20)io.stargate.sdk.core.domain.Page
<io.stargate.sdk.data.domain.JsonDocumentResult> findVectorPage
(io.stargate.sdk.data.domain.query.SelectQuery query) find Page.io.stargate.sdk.data.CollectionClient
Internal Client for a collection.final List
<io.stargate.sdk.data.domain.JsonDocumentMutationResult> insertMany
(String json) Insert multiple documents (up to 20) as a Json String , for more document checkinsertManyChunked
.final <DOC> List
<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>> insertMany
(List<io.stargate.sdk.data.domain.odm.Document<DOC>> documents) Insert multiple documents (up to 20) as genericDocument<T>
List , for more document checkinsertManyChunked
.final CompletableFuture
<List<io.stargate.sdk.data.domain.JsonDocumentMutationResult>> insertManyASync
(String json) Insert multiple documents (up to 20) as a Json String , for more document checkinsertManyChunked
, Asynchronously.final <DOC> CompletableFuture
<List<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>>> insertManyASync
(List<io.stargate.sdk.data.domain.odm.Document<DOC>> documents) Insert multiple documents (up to 20) as genericDocument<T>
List , for more document checkinsertManyChunked
, asynchronously.final <DOC> List
<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>> insertManyChunked
(List<io.stargate.sdk.data.domain.odm.Document<DOC>> documents, int chunkSize, int concurrency) Insert large number of documents as genericDocument<T>
List.final <DOC> CompletableFuture
<List<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>>> insertManyChunkedASync
(List<io.stargate.sdk.data.domain.odm.Document<DOC>> documents, int chunkSize, int concurrency) Insert large number of documents as genericDocument<T>
List.final List
<io.stargate.sdk.data.domain.JsonDocumentMutationResult> insertManyChunkedJsonDocuments
(List<io.stargate.sdk.data.domain.JsonDocument> documents, int chunkSize, int concurrency) Insert large number of documents asJsonDocument
List.final CompletableFuture
<List<io.stargate.sdk.data.domain.JsonDocumentMutationResult>> insertManyChunkedJsonDocumentsAsync
(List<io.stargate.sdk.data.domain.JsonDocument> documents, int chunkSize, int concurrency) Insert large number of documents asJsonDocument
List.final List
<io.stargate.sdk.data.domain.JsonDocumentMutationResult> insertManyJsonDocuments
(List<io.stargate.sdk.data.domain.JsonDocument> documents) Insert multiple documents (up to 20) asJsonDocument
List , for more document checkinsertManyChunked
.final CompletableFuture
<List<io.stargate.sdk.data.domain.JsonDocumentMutationResult>> insertManyJsonDocumentsASync
(List<io.stargate.sdk.data.domain.JsonDocument> documents) Insert multiple documents (up to 20) asJsonDocument
List , for more document checkinsertManyChunked
, asynchronously.final io.stargate.sdk.data.domain.JsonDocumentMutationResult
insertOne
(io.stargate.sdk.data.domain.JsonDocument document) Insert a single document from a Json Document (schemaless).final <DOC> io.stargate.sdk.data.domain.DocumentMutationResult
<DOC> insertOne
(io.stargate.sdk.data.domain.odm.Document<DOC> document) Insert a single document from a Document<T> object (SchemaFull)final io.stargate.sdk.data.domain.JsonDocumentMutationResult
Insert a single document from a Json String.final CompletableFuture
<io.stargate.sdk.data.domain.JsonDocumentMutationResult> insertOneAsync
(String json) Insert a single document from a Json String, asynchronously.final CompletableFuture
<io.stargate.sdk.data.domain.JsonDocumentMutationResult> insertOneASync
(io.stargate.sdk.data.domain.JsonDocument document) Insert a single document from a Json Document (schemaless), asynchronously.final <DOC> CompletableFuture
<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>> insertOneASync
(io.stargate.sdk.data.domain.odm.Document<DOC> document) Insert a single document from a Document<T> object (SchemaFull), asynchronously.boolean
Check existence of a document from its id.io.stargate.sdk.data.domain.UpdateStatus
updateMany
(io.stargate.sdk.data.domain.query.UpdateQuery query) Update many records.io.stargate.sdk.data.domain.UpdateStatus
updateOne
(io.stargate.sdk.data.domain.query.UpdateQuery query) Update a single record.final List
<io.stargate.sdk.data.domain.JsonDocumentMutationResult> upsertMany
(String json) Upsert any items in the collection.final <DOC> List
<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>> upsertMany
(List<io.stargate.sdk.data.domain.odm.Document<DOC>> documents) Upsert any items in the collection.final CompletableFuture
<List<io.stargate.sdk.data.domain.JsonDocumentMutationResult>> upsertManyASync
(String json) Upsert any items in the collection.final <DOC> CompletableFuture
<List<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>>> upsertManyASync
(List<io.stargate.sdk.data.domain.odm.Document<DOC>> documents) Upsert any items in the collection asynchronously.final <DOC> List
<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>> upsertManyChunked
(List<io.stargate.sdk.data.domain.odm.Document<DOC>> documents, int chunkSize, int concurrency) Low level insertion of multiple recordsfinal <DOC> CompletableFuture
<List<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>>> upsertManyChunkedASync
(List<io.stargate.sdk.data.domain.odm.Document<DOC>> documents, int chunkSize, int concurrency) Low level insertion of multiple recordsfinal List
<io.stargate.sdk.data.domain.JsonDocumentMutationResult> upsertManyJsonDocuments
(List<io.stargate.sdk.data.domain.JsonDocument> documents) Upsert any items in the collection.final CompletableFuture
<List<io.stargate.sdk.data.domain.JsonDocumentMutationResult>> upsertManyJsonDocumentsASync
(List<io.stargate.sdk.data.domain.JsonDocument> documents) Upsert any items in the collection.final List
<io.stargate.sdk.data.domain.JsonDocumentMutationResult> upsertManyJsonDocumentsChunked
(List<io.stargate.sdk.data.domain.JsonDocument> documents, int chunkSize, int concurrency) Low level insertion of multiple recordsfinal CompletableFuture
<List<io.stargate.sdk.data.domain.JsonDocumentMutationResult>> upsertManyJsonDocumentsChunkedAsync
(List<io.stargate.sdk.data.domain.JsonDocument> documents, int chunkSize, int concurrency) Low level insertion of multiple recordsfinal io.stargate.sdk.data.domain.JsonDocumentMutationResult
upsertOne
(io.stargate.sdk.data.domain.JsonDocument document) Upsert a single document from a Json Document (schemaless).final <DOC> io.stargate.sdk.data.domain.DocumentMutationResult
<DOC> upsertOne
(io.stargate.sdk.data.domain.odm.Document<DOC> document) Upsert a single document from a Document<T> object (SchemaFull)final io.stargate.sdk.data.domain.JsonDocumentMutationResult
Upsert a single document from a Json String.final CompletableFuture
<io.stargate.sdk.data.domain.JsonDocumentMutationResult> upsertOneASync
(io.stargate.sdk.data.domain.JsonDocument document) Upsert a single document from a Json Document (schemaless), asynchronously.final <DOC> CompletableFuture
<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>> upsertOneASync
(io.stargate.sdk.data.domain.odm.Document<DOC> document) Upsert a single document from a Document<T> object (SchemaFull), asynchronouslyfinal CompletableFuture
<io.stargate.sdk.data.domain.JsonDocumentMutationResult> upsertOneASync
(String json) Upsert a single document from a Json String, asynchronously.
-
Method Details
-
insertOne
Insert a single document from a Json String.- Parameters:
json
- json String- Returns:
- mutation result with status and id
-
insertOneAsync
public final CompletableFuture<io.stargate.sdk.data.domain.JsonDocumentMutationResult> insertOneAsync(String json) Insert a single document from a Json String, asynchronously.- Parameters:
json
- json Strings- Returns:
- mutation result with status and id
-
insertOne
public final io.stargate.sdk.data.domain.JsonDocumentMutationResult insertOne(io.stargate.sdk.data.domain.JsonDocument document) Insert a single document from a Json Document (schemaless).- Parameters:
document
- current bean- Returns:
- mutation result with status and id
-
insertOneASync
public final CompletableFuture<io.stargate.sdk.data.domain.JsonDocumentMutationResult> insertOneASync(io.stargate.sdk.data.domain.JsonDocument document) Insert a single document from a Json Document (schemaless), asynchronously.- Parameters:
document
- current bean- Returns:
- mutation result with status and id
-
insertOne
public final <DOC> io.stargate.sdk.data.domain.DocumentMutationResult<DOC> insertOne(io.stargate.sdk.data.domain.odm.Document<DOC> document) Insert a single document from a Document<T> object (SchemaFull)- Type Parameters:
DOC
- payload of document- Parameters:
document
- current bean- Returns:
- mutation result with status and id
-
insertOneASync
public final <DOC> CompletableFuture<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>> insertOneASync(io.stargate.sdk.data.domain.odm.Document<DOC> document) Insert a single document from a Document<T> object (SchemaFull), asynchronously.- Type Parameters:
DOC
- payload of document- Parameters:
document
- current bean- Returns:
- mutation result with status and id
-
upsertOne
Upsert a single document from a Json String.- Parameters:
json
- json Strings- Returns:
- mutation result with status and id
-
upsertOneASync
public final CompletableFuture<io.stargate.sdk.data.domain.JsonDocumentMutationResult> upsertOneASync(String json) Upsert a single document from a Json String, asynchronously.- Parameters:
json
- json Strings- Returns:
- mutation result with status and id
-
upsertOne
public final io.stargate.sdk.data.domain.JsonDocumentMutationResult upsertOne(io.stargate.sdk.data.domain.JsonDocument document) Upsert a single document from a Json Document (schemaless).- Parameters:
document
- current document- Returns:
- document id
-
upsertOneASync
public final CompletableFuture<io.stargate.sdk.data.domain.JsonDocumentMutationResult> upsertOneASync(io.stargate.sdk.data.domain.JsonDocument document) Upsert a single document from a Json Document (schemaless), asynchronously.- Parameters:
document
- current document- Returns:
- document id
-
upsertOne
public final <DOC> io.stargate.sdk.data.domain.DocumentMutationResult<DOC> upsertOne(io.stargate.sdk.data.domain.odm.Document<DOC> document) Upsert a single document from a Document<T> object (SchemaFull)- Type Parameters:
DOC
- payload of document- Parameters:
document
- current document- Returns:
- document id
-
upsertOneASync
public final <DOC> CompletableFuture<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>> upsertOneASync(io.stargate.sdk.data.domain.odm.Document<DOC> document) Upsert a single document from a Document<T> object (SchemaFull), asynchronously- Type Parameters:
DOC
- payload of document- Parameters:
document
- current document- Returns:
- document id
-
insertMany
Insert multiple documents (up to 20) as a Json String , for more document checkinsertManyChunked
.- Parameters:
json
- json String- Returns:
- for each document its id and insertion status
-
insertManyASync
public final CompletableFuture<List<io.stargate.sdk.data.domain.JsonDocumentMutationResult>> insertManyASync(String json) Insert multiple documents (up to 20) as a Json String , for more document checkinsertManyChunked
, Asynchronously.- Parameters:
json
- json String- Returns:
- for each document its id and insertion status
-
insertManyJsonDocuments
public final List<io.stargate.sdk.data.domain.JsonDocumentMutationResult> insertManyJsonDocuments(List<io.stargate.sdk.data.domain.JsonDocument> documents) Insert multiple documents (up to 20) asJsonDocument
List , for more document checkinsertManyChunked
.- Parameters:
documents
- list of documents- Returns:
- for each document its id and insertion status
-
insertManyJsonDocumentsASync
public final CompletableFuture<List<io.stargate.sdk.data.domain.JsonDocumentMutationResult>> insertManyJsonDocumentsASync(List<io.stargate.sdk.data.domain.JsonDocument> documents) Insert multiple documents (up to 20) asJsonDocument
List , for more document checkinsertManyChunked
, asynchronously.- Parameters:
documents
- list of documents- Returns:
- for each document its id and insertion status
-
insertMany
public final <DOC> List<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>> insertMany(List<io.stargate.sdk.data.domain.odm.Document<DOC>> documents) Insert multiple documents (up to 20) as genericDocument<T>
List , for more document checkinsertManyChunked
.- Type Parameters:
DOC
- payload of document- Parameters:
documents
- list of documents- Returns:
- list of ids
-
insertManyASync
public final <DOC> CompletableFuture<List<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>>> insertManyASync(List<io.stargate.sdk.data.domain.odm.Document<DOC>> documents) Insert multiple documents (up to 20) as genericDocument<T>
List , for more document checkinsertManyChunked
, asynchronously.- Type Parameters:
DOC
- payload of document- Parameters:
documents
- list of documents- Returns:
- list of ids
-
insertManyChunked
public final <DOC> List<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>> insertManyChunked(List<io.stargate.sdk.data.domain.odm.Document<DOC>> documents, int chunkSize, int concurrency) Insert large number of documents as genericDocument<T>
List. Insertions a redistributed in chunks and chunk processing are parallelized.- Type Parameters:
DOC
- payload for the documents- Parameters:
documents
- list of documentschunkSize
- number of documents in one chunk (up to 20)concurrency
- number of chunks processed in parallel (depends on document size)- Returns:
- list of ids
-
insertManyChunkedASync
public final <DOC> CompletableFuture<List<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>>> insertManyChunkedASync(List<io.stargate.sdk.data.domain.odm.Document<DOC>> documents, int chunkSize, int concurrency) Insert large number of documents as genericDocument<T>
List. Insertions a redistributed in chunks and chunk processing are parallelized., Asynchronously- Type Parameters:
DOC
- represent the pojo, payload of document- Parameters:
documents
- list of documentschunkSize
- size of the blockconcurrency
- number of blocks in parallel- Returns:
- list of ids
-
insertManyChunkedJsonDocuments
public final List<io.stargate.sdk.data.domain.JsonDocumentMutationResult> insertManyChunkedJsonDocuments(List<io.stargate.sdk.data.domain.JsonDocument> documents, int chunkSize, int concurrency) Insert large number of documents asJsonDocument
List. Insertions a redistributed in chunks and chunk processing are parallelized.,- Parameters:
documents
- list of documentschunkSize
- size of the blockconcurrency
- number of blocks in parallel- Returns:
- list of mutation status
-
insertManyChunkedJsonDocumentsAsync
public final CompletableFuture<List<io.stargate.sdk.data.domain.JsonDocumentMutationResult>> insertManyChunkedJsonDocumentsAsync(List<io.stargate.sdk.data.domain.JsonDocument> documents, int chunkSize, int concurrency) Insert large number of documents asJsonDocument
List. Insertions a redistributed in chunks and chunk processing are parallelized., Asynchronously- Parameters:
documents
- list of documentschunkSize
- size of the blockconcurrency
- number of blocks in parallel- Returns:
- list of mutation status
-
upsertMany
Upsert any items in the collection.- Parameters:
json
- json String- Returns:
- list of statuses
-
upsertManyASync
public final CompletableFuture<List<io.stargate.sdk.data.domain.JsonDocumentMutationResult>> upsertManyASync(String json) Upsert any items in the collection.- Parameters:
json
- json String- Returns:
- list of statuses
-
upsertManyJsonDocuments
public final List<io.stargate.sdk.data.domain.JsonDocumentMutationResult> upsertManyJsonDocuments(List<io.stargate.sdk.data.domain.JsonDocument> documents) Upsert any items in the collection.- Parameters:
documents
- current collection list- Returns:
- list of statuses
-
upsertManyJsonDocumentsASync
public final CompletableFuture<List<io.stargate.sdk.data.domain.JsonDocumentMutationResult>> upsertManyJsonDocumentsASync(List<io.stargate.sdk.data.domain.JsonDocument> documents) Upsert any items in the collection.- Parameters:
documents
- current collection list- Returns:
- list of statuses
-
upsertMany
public final <DOC> List<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>> upsertMany(List<io.stargate.sdk.data.domain.odm.Document<DOC>> documents) Upsert any items in the collection.- Type Parameters:
DOC
- represent the pojo, payload of document- Parameters:
documents
- current collection list- Returns:
- list of statuses
-
upsertManyASync
public final <DOC> CompletableFuture<List<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>>> upsertManyASync(List<io.stargate.sdk.data.domain.odm.Document<DOC>> documents) Upsert any items in the collection asynchronously.- Type Parameters:
DOC
- represent the pojo, payload of document- Parameters:
documents
- current collection list- Returns:
- list of statuses
-
upsertManyChunked
public final <DOC> List<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>> upsertManyChunked(List<io.stargate.sdk.data.domain.odm.Document<DOC>> documents, int chunkSize, int concurrency) Low level insertion of multiple records- Type Parameters:
DOC
- represent the pojo, payload of document- Parameters:
documents
- list of documentschunkSize
- size of the blockconcurrency
- concurrency- Returns:
- list of ids
-
upsertManyChunkedASync
public final <DOC> CompletableFuture<List<io.stargate.sdk.data.domain.DocumentMutationResult<DOC>>> upsertManyChunkedASync(List<io.stargate.sdk.data.domain.odm.Document<DOC>> documents, int chunkSize, int concurrency) Low level insertion of multiple records- Type Parameters:
DOC
- represent the pojo, payload of document- Parameters:
documents
- list of documentschunkSize
- size of the blockconcurrency
- concurrency- Returns:
- list of ids
-
upsertManyJsonDocumentsChunked
public final List<io.stargate.sdk.data.domain.JsonDocumentMutationResult> upsertManyJsonDocumentsChunked(List<io.stargate.sdk.data.domain.JsonDocument> documents, int chunkSize, int concurrency) Low level insertion of multiple records- Parameters:
documents
- list of documentschunkSize
- size of the blockconcurrency
- concurrency- Returns:
- list of ids
-
upsertManyJsonDocumentsChunkedAsync
public final CompletableFuture<List<io.stargate.sdk.data.domain.JsonDocumentMutationResult>> upsertManyJsonDocumentsChunkedAsync(List<io.stargate.sdk.data.domain.JsonDocument> documents, int chunkSize, int concurrency) Low level insertion of multiple records- Parameters:
documents
- list of documentschunkSize
- size of the blockconcurrency
- concurrency- Returns:
- list of ids
-
countDocuments
Count Document request.- Returns:
- number of document.
-
countDocuments
Count Document request.- Parameters:
jsonFilter
- request to filter for count- Returns:
- number of document.
-
isDocumentExists
Check existence of a document from its id. Projection to make it as light as possible.- Parameters:
id
- document identifier- Returns:
- existence status
-
findOne
Find one document matching the query.- Parameters:
rawJsonQuery
- query documents and vector- Returns:
- result if exists
-
findOne
public Optional<io.stargate.sdk.data.domain.JsonDocumentResult> findOne(io.stargate.sdk.data.domain.query.SelectQuery query) Find one document matching the query.- Parameters:
query
- query documents and vector- Returns:
- result if exists
-
findOne
public <DOC> Optional<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> findOne(io.stargate.sdk.data.domain.query.SelectQuery query, Class<DOC> clazz) Find one document matching the query.- Type Parameters:
DOC
- class to be marshalled- Parameters:
query
- query documents and vectorclazz
- class of the document- Returns:
- result if exists
-
findOne
public <DOC> Optional<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> findOne(String query, Class<DOC> clazz) Find one document matching the query.- Type Parameters:
DOC
- class to be marshalled- Parameters:
query
- query documents and vectorclazz
- class of the document- Returns:
- result if exists
-
findOne
public <DOC> Optional<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> findOne(io.stargate.sdk.data.domain.query.SelectQuery query, io.stargate.sdk.data.domain.odm.DocumentResultMapper<DOC> mapper) Find one document matching the query.- Type Parameters:
DOC
- class to be marshalled- Parameters:
query
- query documents and vectormapper
- convert a json into expected pojo- Returns:
- result if exists
-
findOne
public <DOC> Optional<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> findOne(String query, io.stargate.sdk.data.domain.odm.DocumentResultMapper<DOC> mapper) Find one document matching the query.- Type Parameters:
DOC
- class to be marshalled- Parameters:
query
- query documents and vectormapper
- convert a json into expected pojo- Returns:
- result if exists
-
findById
Find document from its id.- Parameters:
id
- document identifier- Returns:
- document
-
findById
public <DOC> Optional<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> findById(@NonNull @NonNull String id, Class<DOC> clazz) Find document from its id.- Type Parameters:
DOC
- class to be marshalled- Parameters:
id
- document identifierclazz
- class for target pojo- Returns:
- document
-
findById
public <DOC> Optional<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> findById(@NonNull @NonNull String id, io.stargate.sdk.data.domain.odm.DocumentResultMapper<DOC> mapper) Find document from its id.- Type Parameters:
DOC
- class to be marshalled- Parameters:
id
- document identifiermapper
- convert a json into expected pojo- Returns:
- document
-
findOneByVector
Find document from its vector.- Parameters:
vector
- document vector- Returns:
- document
-
findOneByVector
public <DOC> Optional<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> findOneByVector(float[] vector, Class<DOC> clazz) Find document from its vector.- Type Parameters:
DOC
- class to be marshalled- Parameters:
vector
- document vectorclazz
- class for target pojo- Returns:
- document
-
findOneByVector
public <DOC> Optional<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> findOneByVector(float[] vector, io.stargate.sdk.data.domain.odm.DocumentResultMapper<DOC> mapper) Find document from its vector.- Type Parameters:
DOC
- class to be marshalled- Parameters:
vector
- document vectormapper
- convert a json into expected pojo- Returns:
- document
-
find
public Stream<io.stargate.sdk.data.domain.JsonDocumentResult> find(io.stargate.sdk.data.domain.query.SelectQuery query) Search records with a filter- Parameters:
query
- filter- Returns:
- all items
-
findPage
public io.stargate.sdk.core.domain.Page<io.stargate.sdk.data.domain.JsonDocumentResult> findPage(io.stargate.sdk.data.domain.query.SelectQuery pagedQuery) Find documents matching the pagedQuery.- Parameters:
pagedQuery
- current pagedQuery- Returns:
- page of results
-
findPage
public io.stargate.sdk.core.domain.Page<io.stargate.sdk.data.domain.JsonDocumentResult> findPage(String pagedQuery) Find documents matching the pagedQuery.- Parameters:
pagedQuery
- current pagedQuery- Returns:
- page of results
-
find
public <DOC> Stream<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> find(io.stargate.sdk.data.domain.query.SelectQuery query, Class<DOC> clazz) Search records with a filter- Type Parameters:
DOC
- class to be marshalled- Parameters:
query
- filterclazz
- class for target pojo- Returns:
- all items
-
find
public <DOC> Stream<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> find(io.stargate.sdk.data.domain.query.SelectQuery query, io.stargate.sdk.data.domain.odm.DocumentResultMapper<DOC> mapper) Search records with a filter- Type Parameters:
DOC
- class to be marshalled- Parameters:
query
- filtermapper
- convert a json into expected pojo- Returns:
- all items
-
findAll
Get all items in a collection.- Returns:
- all items
-
findAll
Find All with Object Mapping.- Type Parameters:
DOC
- class to be marshalled- Parameters:
clazz
- class to be used- Returns:
- stream of results
-
findAll
public <DOC> Stream<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> findAll(io.stargate.sdk.data.domain.odm.DocumentResultMapper<DOC> mapper) Find All with Object Mapping.- Type Parameters:
DOC
- class to be marshalled- Parameters:
mapper
- convert a json into expected pojo- Returns:
- stream of results
-
findPage
public <T> io.stargate.sdk.core.domain.Page<io.stargate.sdk.data.domain.odm.DocumentResult<T>> findPage(io.stargate.sdk.data.domain.query.SelectQuery query, Class<T> clazz) Find documents matching the query.- Type Parameters:
T
- class to be marshalled- Parameters:
query
- current queryclazz
- class for target pojo- Returns:
- page of results
-
deleteOne
public int deleteOne(io.stargate.sdk.data.domain.query.DeleteQuery deleteQuery) Delete single record from a request.- Parameters:
deleteQuery
- delete query- Returns:
- number of deleted records
-
deleteById
Delete single record from its id.- Parameters:
id
- id- Returns:
- number of deleted records
-
deleteByVector
public int deleteByVector(float[] vector) Delete single record from its vector.- Parameters:
vector
- vector- Returns:
- number of deleted records
-
deleteMany
public int deleteMany(io.stargate.sdk.data.domain.query.DeleteQuery deleteQuery) Delete multiple records from a request.- Parameters:
deleteQuery
- delete query- Returns:
- number of deleted records
-
deleteAll
public int deleteAll()Clear the collection.- Returns:
- number of items deleted
-
findOneAndUpdate
public io.stargate.sdk.data.domain.JsonResultUpdate findOneAndUpdate(io.stargate.sdk.data.domain.query.UpdateQuery query) Find ana update a record based on a query,- Parameters:
query
- query to find the record- Returns:
- result of the update
-
findOneAndReplace
public io.stargate.sdk.data.domain.JsonResultUpdate findOneAndReplace(io.stargate.sdk.data.domain.query.UpdateQuery query) Find ana replace a record based on a query,- Parameters:
query
- query to find the record- Returns:
- result of the update
-
findOneAndDelete
public io.stargate.sdk.data.domain.JsonResultUpdate findOneAndDelete(io.stargate.sdk.data.domain.query.UpdateQuery query) Find ana delete a record based on a query.- Parameters:
query
- query to find the record- Returns:
- result of the update
-
updateOne
public io.stargate.sdk.data.domain.UpdateStatus updateOne(io.stargate.sdk.data.domain.query.UpdateQuery query) Update a single record.- Parameters:
query
- query to find the record- Returns:
- update status
-
updateMany
public io.stargate.sdk.data.domain.UpdateStatus updateMany(io.stargate.sdk.data.domain.query.UpdateQuery query) Update many records.- Parameters:
query
- query to find the record- Returns:
- update status
-
findVector
public Stream<io.stargate.sdk.data.domain.JsonDocumentResult> findVector(float[] vector, Integer limit) Query builder.- Parameters:
vector
- vector embeddingslimit
- limit for output- Returns:
- result page
-
findVector
public Stream<io.stargate.sdk.data.domain.JsonDocumentResult> findVector(float[] vector, io.stargate.sdk.data.domain.query.Filter filter, Integer limit) Query builder.- Parameters:
vector
- vector embeddingsfilter
- metadata filterlimit
- limit for output- Returns:
- result page
-
findVectorPage
public io.stargate.sdk.core.domain.Page<io.stargate.sdk.data.domain.JsonDocumentResult> findVectorPage(io.stargate.sdk.data.domain.query.SelectQuery query) find Page.- Parameters:
query
- return query Page- Returns:
- page of results
-
findVectorPage
public io.stargate.sdk.core.domain.Page<io.stargate.sdk.data.domain.JsonDocumentResult> findVectorPage(float[] vector, io.stargate.sdk.data.domain.query.Filter filter, Integer limit, String pagingState) Query builder.- Parameters:
vector
- vector embeddingsfilter
- metadata filterlimit
- limitpagingState
- paging state- Returns:
- result page
-
findVectorPage
public <DOC> io.stargate.sdk.core.domain.Page<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> findVectorPage(float[] vector, io.stargate.sdk.data.domain.query.Filter filter, Integer limit, String pagingState, Class<DOC> clazz) Search similarity from the vector (page by 20)- Type Parameters:
DOC
- type of document- Parameters:
vector
- vector embeddingsfilter
- metadata filterlimit
- limitpagingState
- paging stateclazz
- current class.- Returns:
- page of results
-
findVectorPage
public <DOC> io.stargate.sdk.core.domain.Page<io.stargate.sdk.data.domain.odm.DocumentResult<DOC>> findVectorPage(float[] vector, io.stargate.sdk.data.domain.query.Filter filter, Integer limit, String pagingState, io.stargate.sdk.data.domain.odm.DocumentResultMapper<DOC> mapper) Search similarity from the vector (page by 20)- Type Parameters:
DOC
- type of document- Parameters:
vector
- vector embeddingsfilter
- metadata filterlimit
- limitpagingState
- paging statemapper
- result mapper- Returns:
- page of results
-
findVector
Retrieve documents from a vector.- Parameters:
vector
- vector list- Returns:
- the list of results
-
findVector
public Stream<io.stargate.sdk.data.domain.JsonDocumentResult> findVector(float[] vector, io.stargate.sdk.data.domain.query.Filter filter, int recordCount) Retrieve documents from a vector.- Parameters:
vector
- vector listfilter
- metadata filterrecordCount
- record count- Returns:
- the list of results
-
findVector
public <T> Stream<io.stargate.sdk.data.domain.odm.DocumentResult<T>> findVector(float[] vector, Class<T> clazz) Retrieve documents from a vector.- Type Parameters:
T
- expected type- Parameters:
vector
- vector listclazz
- expected output class- Returns:
- the list of results
-
findVector
public <T> Stream<io.stargate.sdk.data.domain.odm.DocumentResult<T>> findVector(float[] vector, io.stargate.sdk.data.domain.odm.DocumentResultMapper<T> mapper) Retrieve documents from a vector.- Type Parameters:
T
- expected type- Parameters:
vector
- vector listmapper
- mapper for results- Returns:
- the list of results
-
findVector
public Stream<io.stargate.sdk.data.domain.JsonDocumentResult> findVector(io.stargate.sdk.data.domain.query.SelectQuery query) Full-fledged search with a filter and conditions.- Parameters:
query
- vector query- Returns:
- stream of results
-
findVector
public <T> Stream<io.stargate.sdk.data.domain.odm.DocumentResult<T>> findVector(io.stargate.sdk.data.domain.query.SelectQuery query, Class<T> clazz) Full-fledged search with a filter and conditions.- Type Parameters:
T
- expected type- Parameters:
query
- vector queryclazz
- clazz for returned type- Returns:
- stream of results
-
findVector
public <T> Stream<io.stargate.sdk.data.domain.odm.DocumentResult<T>> findVector(io.stargate.sdk.data.domain.query.SelectQuery query, io.stargate.sdk.data.domain.odm.DocumentResultMapper<T> mapper) Full-fledged search with a filter and conditions.- Type Parameters:
T
- expected type- Parameters:
query
- vector querymapper
- mapper for results- Returns:
- stream of results
-
findVector
public Stream<io.stargate.sdk.data.domain.JsonDocumentResult> findVector(float[] vector, io.stargate.sdk.data.domain.query.Filter filter, Integer limit, boolean includeSimilarity) Query builder.- Parameters:
vector
- vector embeddingsfilter
- metadata filterlimit
- how many items to be retrieved at mostincludeSimilarity
- include similarity- Returns:
- result page
-
findPageVector
public io.stargate.sdk.core.domain.Page<io.stargate.sdk.data.domain.JsonDocumentResult> findPageVector(io.stargate.sdk.data.domain.query.SelectQuery query) Query builder.- Parameters:
query
- query- Returns:
- result page
-
getRawCollectionClient
public io.stargate.sdk.data.CollectionClient getRawCollectionClient()Internal Client for a collection.- Returns:
- collection client
-
enableOrderingWhenInsert
public void enableOrderingWhenInsert()Set this options during insertMany: {"ordered": true}. -
disableOrderingWhenInsert
public void disableOrderingWhenInsert()Set this options during insertMany: {"ordered": false}.
-