mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-25 14:08:30 +02:00
add is_tenant to multitenancy docs (#1076)
* add is_tenant to multitenancy docs * fix alert * fix alert * update python snippet
This commit is contained in:
@@ -404,11 +404,19 @@ await client.CreateCollectionAsync(
|
||||
|
||||
3. Create keyword payload index for `group_id` field.
|
||||
|
||||
<aside role="alert">
|
||||
<code>is_tenant</code> parameter is available as of v1.11.0. Previous versions should use default options for keyword index creation.
|
||||
</aside>
|
||||
|
||||
|
||||
```http
|
||||
PUT /collections/{collection_name}/index
|
||||
{
|
||||
"field_name": "group_id",
|
||||
"field_schema": "keyword"
|
||||
"field_schema": {
|
||||
"type": "keyword",
|
||||
"is_tenant": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -416,43 +424,69 @@ PUT /collections/{collection_name}/index
|
||||
client.create_payload_index(
|
||||
collection_name="{collection_name}",
|
||||
field_name="group_id",
|
||||
field_schema=models.PayloadSchemaType.KEYWORD,
|
||||
field_schema=models.KeywordIndexParams(
|
||||
type="keywprd",
|
||||
is_tenant=True,
|
||||
),
|
||||
)
|
||||
```
|
||||
|
||||
```typescript
|
||||
client.createPayloadIndex("{collection_name}", {
|
||||
field_name: "group_id",
|
||||
field_schema: "keyword",
|
||||
field_schema: {
|
||||
type: "keyword",
|
||||
is_tenant: true,
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
```rust
|
||||
use qdrant_client::qdrant::{CreateFieldIndexCollectionBuilder, FieldType};
|
||||
use qdrant_client::qdrant::{
|
||||
CreateFieldIndexCollectionBuilder,
|
||||
KeywordIndexParamsBuilder,
|
||||
FieldType
|
||||
};
|
||||
use qdrant_client::{Qdrant, QdrantError};
|
||||
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
|
||||
client
|
||||
.create_field_index(CreateFieldIndexCollectionBuilder::new(
|
||||
"{collection_name}",
|
||||
"group_id",
|
||||
FieldType::Keyword,
|
||||
))
|
||||
.await?;
|
||||
client.create_field_index(
|
||||
CreateFieldIndexCollectionBuilder::new(
|
||||
"{collection_name}",
|
||||
"group_id",
|
||||
FieldType::Keyword,
|
||||
).field_index_params(
|
||||
KeywordIndexParamsBuilder::default()
|
||||
.is_tenant(true)
|
||||
)
|
||||
).await?;
|
||||
```
|
||||
|
||||
```java
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
import io.qdrant.client.grpc.Collections.PayloadIndexParams;
|
||||
import io.qdrant.client.grpc.Collections.PayloadSchemaType;
|
||||
import io.qdrant.client.grpc.Collections.KeywordIndexParams;
|
||||
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
|
||||
client
|
||||
.createPayloadIndexAsync(
|
||||
"{collection_name}", "group_id", PayloadSchsemaType.Keyword, null, null, null, null)
|
||||
"{collection_name}",
|
||||
"group_id",
|
||||
PayloadSchemaType.Keyword,
|
||||
PayloadIndexParams.newBuilder()
|
||||
.setKeywordIndexParams(
|
||||
KeywordIndexParams.newBuilder()
|
||||
.setIsTenant(true)
|
||||
.build())
|
||||
.build(),
|
||||
null,
|
||||
null,
|
||||
null)
|
||||
.get();
|
||||
```
|
||||
|
||||
@@ -461,9 +495,25 @@ using Qdrant.Client;
|
||||
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.CreatePayloadIndexAsync(collectionName: "{collection_name}", fieldName: "group_id");
|
||||
await client.CreatePayloadIndexAsync(
|
||||
collectionName: "{collection_name}",
|
||||
fieldName: "group_id",
|
||||
schemaType: PayloadSchemaType.Keyword,
|
||||
indexParams: new PayloadIndexParams
|
||||
{
|
||||
KeywordIndexParams = new KeywordIndexParams
|
||||
{
|
||||
IsTenant = true
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
```
|
||||
|
||||
`is_tenant=true` parameter is optional, but specifying it provides storage with additional inforamtion about the usage patterns the collection is going to use.
|
||||
When specified, storage structure will be organized in a way to co-locate vectors of the same tenant together, which can significantly improve performance in some cases.
|
||||
|
||||
|
||||
## Limitations
|
||||
|
||||
One downside to this approach is that global requests (without the `group_id` filter) will be slower since they will necessitate scanning all groups to identify the nearest neighbors.
|
||||
|
||||
Reference in New Issue
Block a user