Package io.milvus.param.index
Class CreateIndexParam.Builder
- java.lang.Object
-
- io.milvus.param.index.CreateIndexParam.Builder
-
- Enclosing class:
- CreateIndexParam
public static final class CreateIndexParam.Builder extends java.lang.Object
Builder forCreateIndexParam
class.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CreateIndexParam
build()
Verifies parameters and creates a newCreateIndexParam
instance.CreateIndexParam.Builder
withCollectionName(@NonNull java.lang.String collectionName)
Set the collection name.CreateIndexParam.Builder
withDatabaseName(java.lang.String databaseName)
Sets the database name.CreateIndexParam.Builder
withExtraParam(@NonNull java.lang.String extraParam)
Sets the specific index parameters according to index type.CreateIndexParam.Builder
withFieldName(@NonNull java.lang.String fieldName)
Sets the target field name.CreateIndexParam.Builder
withIndexName(@NonNull java.lang.String indexName)
The name of index which will be created.CreateIndexParam.Builder
withIndexType(@NonNull IndexType indexType)
Sets the index type.CreateIndexParam.Builder
withMetricType(@NonNull MetricType metricType)
Sets the metric type.CreateIndexParam.Builder
withSyncMode(@NonNull java.lang.Boolean syncMode)
Enables to sync mode.CreateIndexParam.Builder
withSyncWaitingInterval(@NonNull java.lang.Long milliseconds)
Sets the waiting interval in sync mode.CreateIndexParam.Builder
withSyncWaitingTimeout(@NonNull java.lang.Long seconds)
Sets the timeout value for sync mode.
-
-
-
Method Detail
-
withDatabaseName
public CreateIndexParam.Builder withDatabaseName(java.lang.String databaseName)
Sets the database name. database name can be nil.- Parameters:
databaseName
- database name- Returns:
Builder
-
withCollectionName
public CreateIndexParam.Builder withCollectionName(@NonNull @NonNull java.lang.String collectionName)
Set the collection name. Collection name cannot be empty or null.- Parameters:
collectionName
- collection name- Returns:
Builder
-
withFieldName
public CreateIndexParam.Builder withFieldName(@NonNull @NonNull java.lang.String fieldName)
Sets the target field name. Field name cannot be empty or null.- Parameters:
fieldName
- field name- Returns:
Builder
-
withIndexType
public CreateIndexParam.Builder withIndexType(@NonNull @NonNull IndexType indexType)
Sets the index type.- Parameters:
indexType
- index type- Returns:
Builder
-
withIndexName
public CreateIndexParam.Builder withIndexName(@NonNull @NonNull java.lang.String indexName)
The name of index which will be created. Then you can use the index name to check the state of index. If no index name is specified, the default index name("_default_idx") is used.- Parameters:
indexName
- index name- Returns:
Builder
-
withMetricType
public CreateIndexParam.Builder withMetricType(@NonNull @NonNull MetricType metricType)
Sets the metric type.- Parameters:
metricType
- metric type- Returns:
Builder
-
withExtraParam
public CreateIndexParam.Builder withExtraParam(@NonNull @NonNull java.lang.String extraParam)
Sets the specific index parameters according to index type. For example: IVF index, the extra parameters can be "{\"nlist\":1024}". For more information: @see Index Selection- Parameters:
extraParam
- extra parameters in .json format- Returns:
Builder
-
withSyncMode
public CreateIndexParam.Builder withSyncMode(@NonNull @NonNull java.lang.Boolean syncMode)
Enables to sync mode. With sync mode enabled, the client keeps waiting until all segments of the collection are successfully indexed. With sync mode disabled, client returns at once after the createIndex() is called.- Parameters:
syncMode
-Boolean.TRUE
is sync mode, Boolean.FALSE is not- Returns:
Builder
-
withSyncWaitingInterval
public CreateIndexParam.Builder withSyncWaitingInterval(@NonNull @NonNull java.lang.Long milliseconds)
Sets the waiting interval in sync mode. With sync mode enabled, the client constantly checks index state by interval. Interval must be greater than zero, and cannot be greater than Constant.MAX_WAITING_INDEX_INTERVAL. Default value is 500 milliseconds.- Parameters:
milliseconds
- interval- Returns:
Builder
- See Also:
Constant
-
withSyncWaitingTimeout
public CreateIndexParam.Builder withSyncWaitingTimeout(@NonNull @NonNull java.lang.Long seconds)
Sets the timeout value for sync mode. Timeout value must be greater than zero and with No upper limit. Default value is 600 seconds.- Parameters:
seconds
- time out value for sync mode- Returns:
Builder
- See Also:
Constant
-
build
public CreateIndexParam build() throws ParamException
Verifies parameters and creates a newCreateIndexParam
instance.- Returns:
CreateIndexParam
- Throws:
ParamException
-
-