public class Index extends java.lang.Object implements IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>
Example:
import io.pinecone.clients.Pinecone;
import io.pinecone.clients.Index;
Pinecone client = new Pinecone.Builder(System.getenv("PINECONE_API_KEY")).build();
Index index = client.getIndexConnection("my-index");
| Constructor and Description |
|---|
Index(PineconeConnection connection,
java.lang.String indexName)
Constructs an
Index instance for interacting with a Pinecone index. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the current index connection gracefully, releasing any resources associated with it.
|
DeleteResponse |
delete(java.util.List<java.lang.String> ids,
boolean deleteAll,
java.lang.String namespace,
com.google.protobuf.Struct filter)
A flexible delete operation allowing for the deletion of vectors by ID, by filter, or all vectors in a namespace.
|
DeleteResponse |
deleteAll(java.lang.String namespace)
Deletes all vectors within a specified namespace.
|
DeleteResponse |
deleteByFilter(com.google.protobuf.Struct filter)
Deletes vectors matching a specific metadata filter criteria from the default namespace.
|
DeleteResponse |
deleteByFilter(com.google.protobuf.Struct filter,
java.lang.String namespace)
Deletes vectors matching a specific metadata filter criteria from a specified namespace.
|
DeleteResponse |
deleteByIds(java.util.List<java.lang.String> ids)
Deletes a list of vectors by ID from the default namespace.
|
DeleteResponse |
deleteByIds(java.util.List<java.lang.String> ids,
java.lang.String namespace)
Deletes vectors identified by a list of unique IDs from a specified namespace.
|
DescribeIndexStatsResponse |
describeIndexStats()
Retrieves statistics about the index's contents, such as vector count per namespace, and number of dimensions.
|
DescribeIndexStatsResponse |
describeIndexStats(com.google.protobuf.Struct filter)
Retrieves statistics about the index's contents for vectors that satisfy the applied metadata filter.
|
FetchResponse |
fetch(java.util.List<java.lang.String> ids)
Looks up vectors by ID from the default namespace.
|
FetchResponse |
fetch(java.util.List<java.lang.String> ids,
java.lang.String namespace)
Looks up vectors by ID from a specified namespace.
|
ListResponse |
list()
Retrieves up to
100 vector IDs from an index from the default namespace. |
ListResponse |
list(java.lang.String namespace)
Retrieves up to
100 vector IDs from a given namespace. |
ListResponse |
list(java.lang.String namespace,
int limit)
Retrieves up to
n vector IDs from a given namespace, where limit == n. |
ListResponse |
list(java.lang.String namespace,
int limit,
java.lang.String paginationToken)
Retrieves up to
n vector IDs from a given namespace, targeted with a specific
paginationToken, where limit == n. |
ListResponse |
list(java.lang.String namespace,
java.lang.String prefix)
Retrieves up to
100 vector IDs from a given namespace, filtered by a given prefix. |
ListResponse |
list(java.lang.String namespace,
java.lang.String prefix,
int limit)
Retrieves up to
n vector IDs from a given namespace, filtered by a given prefix, where limit` == n. |
ListResponse |
list(java.lang.String namespace,
java.lang.String prefix,
java.lang.String paginationToken)
Retrieves up to
100 vector IDs from a given namespace, filtered by a given prefix, targeted with a
specific
paginationToken. |
ListResponse |
list(java.lang.String namespace,
java.lang.String prefix,
java.lang.String paginationToken,
int limit)
Base method that retrieves a list of vector IDs from a specific namespace within an index.
|
QueryResponseWithUnsignedIndices |
query(int topK,
java.util.List<java.lang.Float> vector,
java.util.List<java.lang.Long> sparseIndices,
java.util.List<java.lang.Float> sparseValues,
java.lang.String id,
java.lang.String namespace,
com.google.protobuf.Struct filter,
boolean includeValues,
boolean includeMetadata)
Queries a namespace using a provided query vector.
|
QueryResponseWithUnsignedIndices |
queryByVector(int topK,
java.util.List<java.lang.Float> vector)
Queries the default namespace using a provided query vector.
|
QueryResponseWithUnsignedIndices |
queryByVector(int topK,
java.util.List<java.lang.Float> vector,
boolean includeValues,
boolean includeMetadata)
Queries the default namespace using a provided query vector, with options to include values and metadata in the results.
|
QueryResponseWithUnsignedIndices |
queryByVector(int topK,
java.util.List<java.lang.Float> vector,
java.lang.String namespace)
Queries a specified namespace using a provided query vector.
|
QueryResponseWithUnsignedIndices |
queryByVector(int topK,
java.util.List<java.lang.Float> vector,
java.lang.String namespace,
boolean includeValues,
boolean includeMetadata)
Queries a specified namespace using a provided query vector, with options to include values and metadata in the results.
|
QueryResponseWithUnsignedIndices |
queryByVector(int topK,
java.util.List<java.lang.Float> vector,
java.lang.String namespace,
com.google.protobuf.Struct filter)
Queries a specified namespace using a provided query vector and a custom filter.
|
QueryResponseWithUnsignedIndices |
queryByVector(int topK,
java.util.List<java.lang.Float> vector,
java.lang.String namespace,
com.google.protobuf.Struct filter,
boolean includeValues,
boolean includeMetadata)
Queries a specified namespace using a provided query vector, a custom filter, and options to include values and metadata in the results.
|
QueryResponseWithUnsignedIndices |
queryByVectorId(int topK,
java.lang.String id)
Queries a namespace using a query vector.
|
QueryResponseWithUnsignedIndices |
queryByVectorId(int topK,
java.lang.String id,
boolean includeValues,
boolean includeMetadata)
Queries a namespace using a query vector identified by an ID, with options to include values and metadata in the results.
|
QueryResponseWithUnsignedIndices |
queryByVectorId(int topK,
java.lang.String id,
java.lang.String namespace)
Queries a specified namespace using a vector ID.
|
QueryResponseWithUnsignedIndices |
queryByVectorId(int topK,
java.lang.String id,
java.lang.String namespace,
boolean includeValues,
boolean includeMetadata)
Queries a specified namespace using a vector ID, with options to include values and metadata in the results.
|
QueryResponseWithUnsignedIndices |
queryByVectorId(int topK,
java.lang.String id,
java.lang.String namespace,
com.google.protobuf.Struct filter)
Queries a specified namespace using a vector ID and a custom filter.
|
QueryResponseWithUnsignedIndices |
queryByVectorId(int topK,
java.lang.String id,
java.lang.String namespace,
com.google.protobuf.Struct filter,
boolean includeValues,
boolean includeMetadata)
Queries a specified namespace using a vector ID, a custom filter, and options to include values and metadata in the results.
|
UpdateResponse |
update(java.lang.String id,
java.util.List<java.lang.Float> values)
Updates an existing vector by ID with new values in the default namespace.
|
UpdateResponse |
update(java.lang.String id,
java.util.List<java.lang.Float> values,
java.lang.String namespace)
Updates an existing vector by ID with new values in a specified namespace.
|
UpdateResponse |
update(java.lang.String id,
java.util.List<java.lang.Float> values,
com.google.protobuf.Struct metadata,
java.lang.String namespace,
java.util.List<java.lang.Long> sparseIndices,
java.util.List<java.lang.Float> sparseValues)
Updates an existing vector by ID in a specified namespace.
|
UpsertResponse |
upsert(java.util.List<VectorWithUnsignedIndices> vectorList,
java.lang.String namespace)
Performs an upsert operation for a list of vectors within a namespace.
|
UpsertResponse |
upsert(java.lang.String id,
java.util.List<java.lang.Float> values)
Performs an upsert operation for a single vector in the default namespace.
|
UpsertResponse |
upsert(java.lang.String id,
java.util.List<java.lang.Float> values,
java.util.List<java.lang.Long> sparseIndices,
java.util.List<java.lang.Float> sparseValues,
com.google.protobuf.Struct metadata,
java.lang.String namespace)
Upserts a vector with both dense and sparse components, and optional metadata, into a specified namespace.
|
UpsertResponse |
upsert(java.lang.String id,
java.util.List<java.lang.Float> values,
java.lang.String namespace)
Performs an upsert operation for a single vector in the specified namespace.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbuildUpsertVector, buildUpsertVectorWithUnsignedIndices, validateDeleteRequest, validateDescribeIndexStatsRequest, validateFetchRequest, validateListEndpointParameters, validateQueryRequest, validateUpdateRequest, validateUpsertRequest, validateUpsertRequestpublic Index(PineconeConnection connection, java.lang.String indexName)
Index instance for interacting with a Pinecone index.
Example:
import io.pinecone.clients.Pinecone;
import io.pinecone.clients.Index;
Pinecone client = new Pinecone.Builder(System.getenv("PINECONE_API_KEY")).build();
Index index = client.getIndexConnection("my-index");
connection - The PineconeConnection configuration to be used for this index.indexName - The name of the index to interact with. The index host will be automatically resolved.PineconeValidationException - if the connection object is null.public UpsertResponse upsert(java.util.List<VectorWithUnsignedIndices> vectorList, java.lang.String namespace)
Example:
import io.pinecone.proto.UpsertResponse;
import io.pinecone.unsigned_indices_model.VectorWithUnsignedIndices;
import static io.pinecone.commons.IndexInterface.buildUpsertVectorWithUnsignedIndices;
...
// Vector ids to be upserted
List<String> upsertIds = Arrays.asList("v1", "v2", "v3");
// List of values to be upserted
List<List<Float>> values = new ArrayList<>();
values.add(Arrays.asList(1.0f, 2.0f, 3.0f));
values.add(Arrays.asList(4.0f, 5.0f, 6.0f));
values.add(Arrays.asList(7.0f, 8.0f, 9.0f));
List<VectorWithUnsignedIndices> vectors = new ArrayList<>(3);
for (int i=0; i<upsertIds.size(); i++) {
vectors.add(
buildUpsertVectorWithUnsignedIndices(upsertIds.get(i),
values.get(i), null, null, null));
}
UpsertResponse upsertResponse = index.upsert(vectors, "example-namespace");
upsert in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>vectorList - A list of vectors with unsigned indices to upsert.namespace - The namespace where the vectors should be upserted. This is optional.T indicating the result of the upsert operation.public UpsertResponse upsert(java.lang.String id, java.util.List<java.lang.Float> values)
Example:
index.upsert("my-vector-id", Arrays.asList(1.0f, 2.0f, 3.0f));
upsert in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>id - The unique identifier of the vector.values - The list of floating-point values that represent the vector.T indicating the result of the upsert operation.public UpsertResponse upsert(java.lang.String id, java.util.List<java.lang.Float> values, java.lang.String namespace)
Example:
import io.pinecone.proto.UpsertResponse;
...
UpsertResponse upsertResponse =
index.upsert("my-vector-id",
Arrays.asList(1.0f, 2.0f, 3.0f),
"example-namespace");
upsert in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>id - The unique identifier of the vector.values - The list of floating-point values that represent the vector.namespace - The namespace where the vector should be upserted. This is optional.T indicating the result of the upsert operation.public UpsertResponse upsert(java.lang.String id, java.util.List<java.lang.Float> values, java.util.List<java.lang.Long> sparseIndices, java.util.List<java.lang.Float> sparseValues, com.google.protobuf.Struct metadata, java.lang.String namespace)
Example:
import io.pinecone.proto.UpsertResponse;
import io.pinecone.unsigned_indices_model.VectorWithUnsignedIndices;
import static io.pinecone.commons.IndexInterface.buildUpsertVectorWithUnsignedIndices;
import com.google.protobuf.Struct;
...
// metadata
Struct metadataStruct = Struct.newBuilder()
.putFields("genre", Value.newBuilder().setStringValue("action").build())
.putFields("year", Value.newBuilder().setNumberValue(2019).build())
.build();
UpsertResponse upsertResponse =
index.upsert("my-vector-id",
Arrays.asList(1.0f, 2.0f, 3.0f),
Arrays.asList(1L, 2L, 3L),
Arrays.asList(1000f, 2000f, 3000f),
metadataStruct,
"example-namespace");
upsert in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>id - The unique identifier for the vector.values - The dense vector values.sparseIndices - Indices for sparse vector representation.sparseValues - Values for the sparse indices.metadata - Metadata associated with the vector.namespace - The namespace to upsert the vector into. This is optional.T indicating the result of the upsert operation.public QueryResponseWithUnsignedIndices query(int topK, java.util.List<java.lang.Float> vector, java.util.List<java.lang.Long> sparseIndices, java.util.List<java.lang.Float> sparseValues, java.lang.String id, java.lang.String namespace, com.google.protobuf.Struct filter, boolean includeValues, boolean includeMetadata)
Example:
import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices;
...
QueryResponseWithUnsignedIndices queryResponse =
index.query(10,
Arrays.asList(1.0f, 2.0f, 3.0f),
Arrays.asList(1L, 2L, 3L),
Arrays.asList(1000f, 2000f, 3000f),
null,
"example-namespace",
null,
true,
true);
query in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>topK - The number of top similar vectors to retrieve.vector - The dense query vector as a list of floating-point values. Each query can contain only one of the parameters: vector or id.sparseIndices - The indices of the sparse vector representation, if applicable.sparseValues - The values at the specified indices of the sparse vector representation.id - The unique ID of a vector to be used as a query vector. Each query can contain only one of the parameters: vector or id.namespace - The namespace within which the query is performed.filter - A Struct defining additional filtering criteria for the query.includeValues - Flag indicating whether to include the vector values in the query results.includeMetadata - Flag indicating whether to include the vector metadata in the query results.U representing the query results containing a list of the closest vectors and a namespace name.public QueryResponseWithUnsignedIndices queryByVectorId(int topK, java.lang.String id, java.lang.String namespace, com.google.protobuf.Struct filter, boolean includeValues, boolean includeMetadata)
Example:
import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices;
...
QueryResponseWithUnsignedIndices queryResponse =
index.queryByVectorId(10,
"my-vector-id",
"example-namespace",
null,
true,
true);
queryByVectorId in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>topK - The number of top similar vectors to retrieve.id - The unique ID of a vector to be used as a query vector.namespace - The namespace within which the query is performed.filter - A Struct defining additional filtering criteria for the query.includeValues - Flag indicating whether to include the vector values in the query results.includeMetadata - Flag indicating whether to include the vector metadata in the query results.U representing the query results, including optional values and metadata based on parameters and filtered according to the provided criteria.public QueryResponseWithUnsignedIndices queryByVectorId(int topK, java.lang.String id, java.lang.String namespace, com.google.protobuf.Struct filter)
Example:
import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices;
import com.google.protobuf.Struct;
...
Struct filter = Struct.newBuilder()
.putFields("genre", Value.newBuilder().setStringValue("action").build()).build();
QueryResponseWithUnsignedIndices queryResponse =
index.queryByVectorId(10,
"my-vector-id",
"example-namespace",
filter);
queryByVectorId in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>topK - The number of top similar vectors to retrieve.id - The unique ID of a vector to be used as a query vector.namespace - The namespace within which the query is performed.filter - A Struct defining additional filtering criteria for the query.U representing the query results, filtered according to the provided criteria.public QueryResponseWithUnsignedIndices queryByVectorId(int topK, java.lang.String id, java.lang.String namespace, boolean includeValues, boolean includeMetadata)
Example:
import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices;
...
QueryResponseWithUnsignedIndices queryResponse =
index.queryByVectorId(10,
"my-vector-id",
"example-namespace",
true,
true);
queryByVectorId in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>topK - The number of top similar vectors to retrieve.id - The unique ID of a vector to be used as a query vector.namespace - The namespace within which the query is performed.includeValues - Flag indicating whether to include the vector values in the query results.includeMetadata - Flag indicating whether to include the vector metadata in the query results.U representing the query results, including optional values and metadata based on parameters.public QueryResponseWithUnsignedIndices queryByVectorId(int topK, java.lang.String id, java.lang.String namespace)
Example:
import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices;
...
QueryResponseWithUnsignedIndices queryResponse =
index.queryByVectorId(10,
"my-vector-id",
"example-namespace");
queryByVectorId in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>topK - The number of top similar vectors to retrieve.id - The unique ID of a vector to be used as a query vector.namespace - The namespace within which the query is performed.U representing the query results.public QueryResponseWithUnsignedIndices queryByVectorId(int topK, java.lang.String id, boolean includeValues, boolean includeMetadata)
Example:
import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices;
...
QueryResponseWithUnsignedIndices queryResponse =
index.queryByVectorId(10,
"my-vector-id",
true,
true);
queryByVectorId in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>topK - The number of top similar vectors to retrieve.id - The unique ID of a vector to be used as a query vector.includeValues - Flag indicating whether to include the vector values in the query results.includeMetadata - Flag indicating whether to include the vector metadata in the query results.U representing the query results, including optional values and metadata based on parameters.public QueryResponseWithUnsignedIndices queryByVectorId(int topK, java.lang.String id)
Example:
import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices;
...
QueryResponseWithUnsignedIndices queryResponse =
index.queryByVectorId(10,
"my-vector-id");
queryByVectorId in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>topK - The number of top similar vectors to retrieve.id - The unique id of a vector to be used as a query vector.U representing the query results.public QueryResponseWithUnsignedIndices queryByVector(int topK, java.util.List<java.lang.Float> vector, java.lang.String namespace, com.google.protobuf.Struct filter, boolean includeValues, boolean includeMetadata)
Example:
import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices;
import com.google.protobuf.Struct;
...
Struct filter = Struct.newBuilder()
.putFields("genre", Value.newBuilder().setStringValue("action").build()).build();
QueryResponseWithUnsignedIndices queryResponse =
index.queryByVector(10,
Arrays.asList(1.0f, 2.0f, 3.0f),
"example-namespace",
filter,
true,
true);
queryByVector in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>topK - The number of top similar vectors to retrieve.vector - The query vector as a list of floating-point values.namespace - The namespace within which the query is performed.filter - A Struct defining additional filtering criteria for the query.includeValues - Flag indicating whether to include the vector values in the query results.includeMetadata - Flag indicating whether to include the vector metadata in the query results.U representing the query results, including optional values and metadata based on parameters and filtered according to the provided criteria.public QueryResponseWithUnsignedIndices queryByVector(int topK, java.util.List<java.lang.Float> vector, java.lang.String namespace, com.google.protobuf.Struct filter)
Example:
import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices;
import com.google.protobuf.Struct;
...
Struct filter = Struct.newBuilder()
.putFields("genre", Value.newBuilder().setStringValue("action").build()).build();
QueryResponseWithUnsignedIndices queryResponse =
index.queryByVector(10,
Arrays.asList(1.0f, 2.0f, 3.0f),
"example-namespace",
filter);
queryByVector in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>topK - The number of top similar vectors to retrieve.vector - The query vector as a list of floating-point values.namespace - The namespace within which the query is performed.filter - A Struct defining additional filtering criteria for the query.U representing the query results, filtered according to the provided criteria.public QueryResponseWithUnsignedIndices queryByVector(int topK, java.util.List<java.lang.Float> vector, java.lang.String namespace, boolean includeValues, boolean includeMetadata)
Example:
import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices;
...
QueryResponseWithUnsignedIndices queryResponse =
index.queryByVector(10,
Arrays.asList(1.0f, 2.0f, 3.0f),
"example-namespace",
true,
true);
queryByVector in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>topK - The number of top similar vectors to retrieve.vector - The query vector as a list of floating-point values.namespace - The namespace within which the query is performed.includeValues - Flag indicating whether to include the vector values in the query results.includeMetadata - Flag indicating whether to include the vector metadata in the query results.U representing the query results, including optional values and metadata based on parameters.public QueryResponseWithUnsignedIndices queryByVector(int topK, java.util.List<java.lang.Float> vector, java.lang.String namespace)
Example:
import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices;
...
QueryResponseWithUnsignedIndices queryResponse =
index.queryByVector(10,
Arrays.asList(1.0f, 2.0f, 3.0f),
"example-namespace");
queryByVector in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>topK - The number of top similar vectors to retrieve.vector - The query vector as a list of floating-point values.namespace - The namespace within which the query is performed.U representing the query results.public QueryResponseWithUnsignedIndices queryByVector(int topK, java.util.List<java.lang.Float> vector, boolean includeValues, boolean includeMetadata)
Example:
import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices;
...
QueryResponseWithUnsignedIndices queryResponse =
index.queryByVector(10,
Arrays.asList(1.0f, 2.0f, 3.0f),
true,
true);
queryByVector in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>topK - The number of top similar vectors to retrieve.vector - The query vector as a list of floating-point values.includeValues - Flag indicating whether to include the vector values in the query results.includeMetadata - Flag indicating whether to include the vector metadata in the query results.U representing the query results, including optional values and metadata based on parameters.public QueryResponseWithUnsignedIndices queryByVector(int topK, java.util.List<java.lang.Float> vector)
Example:
import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices;
...
QueryResponseWithUnsignedIndices queryResponse =
index.queryByVector(10, Arrays.asList(1.0f, 2.0f, 3.0f));
queryByVector in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>topK - The number of top similar vectors to retrieve.vector - The query vector as a list of floating-point values.U representing the query results.public FetchResponse fetch(java.util.List<java.lang.String> ids)
Example:
import io.pinecone.proto.FetchResponse;
...
FetchResponse fetchResponse = index.fetch(Arrays.asList("v1", "v2", "v3"));
fetch in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>ids - A list of unique identifiers for the vectors to fetch.V representing the fetched vectors and the namespace.public FetchResponse fetch(java.util.List<java.lang.String> ids, java.lang.String namespace)
Example:
import io.pinecone.proto.FetchResponse;
...
FetchResponse fetchResponse = index.fetch(Arrays.asList("v1", "v2", "v3"), "example-namespace");
fetch in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>ids - A list of unique identifiers for the vectors to fetch.namespace - The namespace to fetch vectors from.V representing the fetched vectors and the namespace.public UpdateResponse update(java.lang.String id, java.util.List<java.lang.Float> values)
Example:
import io.pinecone.proto.UpdateResponse;
...
UpdateResponse updateResponse = index.update("my-vector-id", Arrays.asList(1.0f, 2.0f, 3.0f));
update in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>id - The unique identifier of the vector to update.values - The new list of vector values to assign to set.W representing the result of the update operation.public UpdateResponse update(java.lang.String id, java.util.List<java.lang.Float> values, java.lang.String namespace)
Example:
import io.pinecone.proto.UpdateResponse;
...
UpdateResponse updateResponse =
index.update("my-vector-id",
Arrays.asList(1.0f, 2.0f, 3.0f),
"example-namespace");
update in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>id - The unique identifier of the vector to update.values - The new list of vector values to assign to set.namespace - The namespace in which to update the vector.W representing the result of the update operation.public UpdateResponse update(java.lang.String id, java.util.List<java.lang.Float> values, com.google.protobuf.Struct metadata, java.lang.String namespace, java.util.List<java.lang.Long> sparseIndices, java.util.List<java.lang.Float> sparseValues)
Example:
import io.pinecone.proto.UpdateResponse;
import com.google.protobuf.Struct;
...
Struct metadata = Struct.newBuilder()
.putFields("genre", Value.newBuilder().setStringValue("action").build())
.putFields("year", Value.newBuilder().setNumberValue(2019).build())
.build();
UpdateResponse updateResponse =
index.update("my-vector-id",
Arrays.asList(1.0f, 2.0f, 3.0f),
metadata,
"example-namespace",
Arrays.asList(1L, 2L, 3L),
Arrays.asList(1000f, 2000f, 3000f));
update in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>id - The unique identifier of the vector to be updated.values - The new list of floating-point values for the vector's dense representation. Previous values are overwritten.metadata - Optional new metadata to associate with the vector. If provided, it replaces the existing metadata.namespace - The namespace in which the vector resides and will be updated.sparseIndices - Indices for the sparse vector representation, if applicable.sparseValues - Values for the sparse vector representation. Must correspond to the provided indices.W representing the result of the update operation.public DeleteResponse deleteByIds(java.util.List<java.lang.String> ids, java.lang.String namespace)
Example:
import io.pinecone.proto.DeleteResponse;
import com.google.protobuf.Struct;
...
DeleteResponse deleteResponse =
index.deleteByIds(Arrays.asList("v1", "v2", "v3"), "example-namespace");
deleteByIds in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>ids - A list of unique vector IDs to be deleted.namespace - The namespace from which the vectors will be deleted.X indicating the result of the delete operation.public DeleteResponse deleteByIds(java.util.List<java.lang.String> ids)
Example:
import io.pinecone.proto.DeleteResponse;
import com.google.protobuf.Struct;
...
DeleteResponse deleteResponse = index.deleteByIds(Arrays.asList("v1", "v2", "v3"));
deleteByIds in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>ids - A list of unique vector IDs to be deleted.X indicating the result of the delete operation.public DeleteResponse deleteByFilter(com.google.protobuf.Struct filter, java.lang.String namespace)
Example:
import io.pinecone.proto.DeleteResponse;
import com.google.protobuf.Struct;
...
Struct filter = Struct.newBuilder()
.putFields("genre", Value.newBuilder().setStringValue("action").build()).build();
DeleteResponse deleteResponse = index.deleteByFilter(filter, "example-namespace");
deleteByFilter in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>filter - The metadata filter used to select vectors to delete.namespace - The namespace from which the vectors matching the filter will be deleted.X indicating the result of the delete operation.public DeleteResponse deleteByFilter(com.google.protobuf.Struct filter)
Example:
import io.pinecone.proto.DeleteResponse;
import com.google.protobuf.Struct;
...
Struct filter = Struct.newBuilder()
.putFields("genre", Value.newBuilder().setStringValue("action").build()).build();
DeleteResponse deleteResponse = index.deleteByFilter(filter);
deleteByFilter in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>filter - The metadata filter used to select vectors to delete.X indicating the result of the delete operation.public DeleteResponse deleteAll(java.lang.String namespace)
null is passed, all vectors in the
default namespace are deleted.
Example:
import io.pinecone.proto.DeleteResponse;
...
DeleteResponse deleteResponse = index.deleteAll("example-namespace");
deleteAll in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>namespace - The namespace from which all vectors will be deleted. If not specified the default will be used.X indicating the result of the delete all operation.public DeleteResponse delete(java.util.List<java.lang.String> ids, boolean deleteAll, java.lang.String namespace, com.google.protobuf.Struct filter)
Example:
import io.pinecone.proto.DeleteResponse;
...
DeleteResponse deleteResponse =
index.delete(Arrays.asList("v1", "v2", "v3"),false,"example-namespace",null);
delete in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>ids - A list of unique identifiers for specific vectors to be deleted. Ignored if deleteAll is true.deleteAll - A boolean flag indicating whether to delete all vectors in the specified namespace.namespace - The namespace from which vectors will be deleted. If not specified, the default namespace is used.filter - An optional Struct defining additional filtering criteria for vectors to be deleted. Ignored if deleteAll is true.X indicating the result of the delete operation.public DescribeIndexStatsResponse describeIndexStats()
Example:
import io.pinecone.proto.DescribeIndexStatsResponse;
...
DescribeIndexStatsResponse describeIndexStatsResponse = index.describeIndexStats();
describeIndexStats in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>Y that contains the stats about the index.public DescribeIndexStatsResponse describeIndexStats(com.google.protobuf.Struct filter)
Example:
import io.pinecone.proto.DescribeIndexStatsResponse;
import com.google.protobuf.Struct;
...
Struct filter = Struct.newBuilder()
.putFields("genre", Value.newBuilder().setStringValue("action").build()).build();
DescribeIndexStatsResponse describeIndexStatsResponse = index.describeIndexStats();
describeIndexStats in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>filter - A metadata filter used to select vectors that satisfy the filter criteria.Y that contains the stats about the index.public ListResponse list()
100 vector IDs from an index from the default namespace.
Example:
import io.pinecone.proto.ListResponse;
...
ListResponse listResponse = index.list();
list in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>Y that contains vector IDs.public ListResponse list(java.lang.String namespace)
100 vector IDs from a given namespace.
Example:
import io.pinecone.proto.ListResponse;
...
ListResponse listResponse = index.list("example-namespace");
list in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>namespace - The namespace that holds the vector IDs you want to retrieve.Y that contains vector IDs.public ListResponse list(java.lang.String namespace, int limit, java.lang.String paginationToken)
n vector IDs from a given namespace, targeted with a specific
paginationToken, where limit == n.
Example:
import io.pinecone.proto.ListResponse;
...
ListResponse listResponse = index.list("example-namespace", 10, "some-pagToken");
list in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>namespace - The namespace that holds the vector IDs you want to retrieve.limit - The maximum number of vector IDs to retrieve.paginationToken - The token to paginate through the list of vector IDs.Y that contains vector IDs.public ListResponse list(java.lang.String namespace, int limit)
n vector IDs from a given namespace, where limit == n.
Example:
import io.pinecone.proto.ListResponse;
...
ListResponse listResponse = index.list("example-namespace", 10);
list in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>namespace - The namespace that holds the vector IDs you want to retrieve.limit - The maximum number of vector IDs to retrieve.Y that contains vector IDs.public ListResponse list(java.lang.String namespace, java.lang.String prefix)
100 vector IDs from a given namespace, filtered by a given prefix.
Example:
import io.pinecone.proto.ListResponse;
...
ListResponse listResponse = index.list("example-namespace", "st-");
list in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>namespace - The namespace that holds the vector IDs you want to retrieve.Y that contains vector IDs.public ListResponse list(java.lang.String namespace, java.lang.String prefix, int limit)
n vector IDs from a given namespace, filtered by a given prefix, where limit` == n.
Example:
import io.pinecone.proto.ListResponse;
...
ListResponse listResponse = index.list("example-namespace", "st-", 10);
list in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>namespace - The namespace that holds the vector IDs you want to retrieve.prefix - The prefix to filter the vector IDs by.limit - The maximum number of vector IDs to retrieve.Y that contains vector IDs.public ListResponse list(java.lang.String namespace, java.lang.String prefix, java.lang.String paginationToken)
100 vector IDs from a given namespace, filtered by a given prefix, targeted with a
specific
paginationToken.
Example:
import io.pinecone.proto.ListResponse;
...
ListResponse listResponse = index.list("example-namespace", "st-", "some-pagToken");
list in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>namespace - The namespace that holds the vector IDs you want to retrieve.paginationToken - The token to paginate through the list of vector IDs.Y that contains vector IDs.public ListResponse list(java.lang.String namespace, java.lang.String prefix, java.lang.String paginationToken, int limit)
Base method that retrieves a list of vector IDs from a specific namespace within an index.
The method internally constructs a ListRequest using the provided namespace
and the provided limit, which cuts off the response after the specified number of IDs. It filters the
retrieve IDs to match a provided prefix. It also can accept a pagination token to deterministically paginate
through a list of vector IDs. It then makes a synchronous RPC call to fetch the list of vector IDs.
Example:
import io.pinecone.proto.ListResponse;
...
ListResponse listResponse = index.list("example-namespace", "st-", "some-pagToken", 10);
list in interface IndexInterface<UpsertResponse,QueryResponseWithUnsignedIndices,FetchResponse,UpdateResponse,DeleteResponse,DescribeIndexStatsResponse,ListResponse>namespace - The namespace that holds the vector IDs you want to retrieve. If namespace is not specified,
the default namespace is used.prefix - The prefix with which vector IDs must start to be included in the response.paginationToken - The token to paginate through the list of vector IDs.limit - The maximum number of vector IDs you want to retrieve.ListResponse containing the list of vector IDs fetched from the specified namespace.
The response includes vector IDs up to 100 items.java.lang.RuntimeException - if there are issues processing the request or communicating with the server.
This includes network issues, server errors, or serialization issues with the request or response.public void close()
indexName and any internal
resources held by the PineconeConnection object.close in interface java.lang.AutoCloseable