pub struct Index { /* private fields */ }
Expand description
Represents a connection to an Index. All Index specific operations are on this type.
Implementations§
Source§impl Index
impl Index
Sourcepub async fn describe(&self) -> Result<IndexDescription>
pub async fn describe(&self) -> Result<IndexDescription>
Creates a brand new IndexDescription from pinecone.
This method can also be used as a kind of Validation for you’re credentials / Index. If it returns an Ok value the Index exists and if it returns an Error it likely does not.
Sourcepub fn url(&self) -> String
pub fn url(&self) -> String
Returns the url for api requests if it’s been cached, this is typically stored in
IndexDescription
Sourcepub async fn describe_stats(&self) -> Result<IndexStats>
pub async fn describe_stats(&self) -> Result<IndexStats>
Grabs the latest IndexStats
from pinecone.
Sourcepub async fn upsert(
&self,
namespace: String,
vectors: Vec<Vector>,
) -> Result<UpsertResponse>
pub async fn upsert( &self, namespace: String, vectors: Vec<Vector>, ) -> Result<UpsertResponse>
Upsert takes in a Vec<Vector>
and attempts to upsert / upload it to pinecone. It will
return a UpsertResponse
which is detailed in Pinecone
Sourcepub async fn delete(self) -> Result<String>
pub async fn delete(self) -> Result<String>
Delete will attempt to delete the current Index and return the associated Message returned by Pinecone when successfull. This will error if the Index does not exist.
Sourcepub async fn configure(
&self,
replicas: usize,
pod_type: String,
) -> Result<String>
pub async fn configure( &self, replicas: usize, pod_type: String, ) -> Result<String>
Configures the current index, specifically [replicas
] and [pod_type
] settings. More can
be found at Pinecone
Sourcepub async fn update(&self, request: UpdateRequest) -> Result<Value>
pub async fn update(&self, request: UpdateRequest) -> Result<Value>
Updates a vector within the index. The return type of the Ok() value should be ignored as this method returns an empty json object.
Sourcepub async fn fetch(&self, request: FetchRequest) -> Result<FetchResponse>
pub async fn fetch(&self, request: FetchRequest) -> Result<FetchResponse>
Looksup and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata.
Sourcepub async fn query(&self, request: QueryRequest) -> Result<QueryResponse>
pub async fn query(&self, request: QueryRequest) -> Result<QueryResponse>
Searches a namespace using a query vector. it retrieves the ids of the most similar items in a namespace, alogn with their similarity scores.