ConsistencyLevel

The consistency level to be used by a Milvus collection.

public enum ConsistencyLevel
{
    Strong = 0,
    Session = 1,
    Bounded = 2,
    BoundedStaleness = 2,  // deprecated; use Bounded
    Eventually = 3,
    Customized = 4  // deprecated
}

Constants:

  • Strong (0)

    The highest and most strict level of consistency, ensuring that users can read the latest version of data.

  • Session (1)

    Ensures that all data writes can be immediately perceived in reads during the same session.

  • Bounded (2)

    Allows data inconsistency during a certain period of time, after which data is generally globally consistent.

  • BoundedStaleness (2)

    Deprecated: renamed to Bounded, matching the Java/C++/Rust/PyMilvus SDKs. This member has the same numeric value (2) and is kept for compatibility; use Bounded instead.

  • Eventually (3)

    The weakest level; there is no guaranteed order of reads and writes, and replicas eventually converge to the same state.

  • Customized (4)

    Deprecated: the Java and C++ V2 SDKs no longer expose a Customized level, and the guarantee timestamp is expected to be derived from the other four levels. This member is kept for compatibility and may be removed in a future release; prefer Strong, Session, Bounded or Eventually.

Example

using Milvus.Client.V2;
using Milvus.Client.V2.Requests.Dql;
using Milvus.Client.V2.Responses.Dql;
using Milvus.Client.V2.Types;

using var client = new MilvusClientV2(new ConnectConfig
{
    Uri = "localhost:19530",
    Username = "root",
    Password = "Milvus"
});

QueryResp results = await client.QueryAsync(new QueryReq
{
    CollectionName = "my_collection",
    Expression = "id in [1, 2, 3]",
    Parameters = new QueryParameters
    {
        ConsistencyLevel = ConsistencyLevel.Strong
    }
});

Try Managed Milvus for Free

Zilliz Cloud is hassle-free, powered by Milvus and 10x faster.

Get Started
Feedback

Was this page helpful?