The bloom filter hashes the entries with MD5 and treats the resulting 128-bit
hash as 2 distinct 64-bit hash values, interpreted as unsigned integers
using 2's complement encoding.
These two hash values, named h1 and h2, are then used to compute the
hash_count hash values using the formula, starting at i=0:
h(i) = h1 + (i * h2)
These resulting values are then taken modulo the number of bits in the bloom
filter to get the bits of the bloom filter to test for the given entry.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eBloomFilter\u003c/code\u003e class in the Google Cloud Firestore v1 API provides a space-efficient probabilistic data structure for testing whether an element is a member of a set.\u003c/p\u003e\n"],["\u003cp\u003eThis class implements several interfaces, including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, offering functionalities such as deep cloning and efficient message handling.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eBloomFilter\u003c/code\u003e can be constructed either with default values using \u003ccode\u003eBloomFilter()\u003c/code\u003e or by cloning an existing \u003ccode\u003eBloomFilter\u003c/code\u003e instance using \u003ccode\u003eBloomFilter(BloomFilter other)\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe class utilizes two key properties: \u003ccode\u003eBits\u003c/code\u003e, which represents the actual bloom filter data as a \u003ccode\u003eBitSequence\u003c/code\u003e, and \u003ccode\u003eHashCount\u003c/code\u003e, an integer that defines the number of hashes used in the algorithm.\u003c/p\u003e\n"],["\u003cp\u003eThe most recent version of the BloomFilter is \u003ccode\u003e3.10.0\u003c/code\u003e in the document, and it goes back to version \u003ccode\u003e2.3.0\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Firestore v1 API - Class BloomFilter (3.10.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.10.0 (latest)](/dotnet/docs/reference/Google.Cloud.Firestore.V1/latest/Google.Cloud.Firestore.V1.BloomFilter)\n- [3.9.0](/dotnet/docs/reference/Google.Cloud.Firestore.V1/3.9.0/Google.Cloud.Firestore.V1.BloomFilter)\n- [3.8.0](/dotnet/docs/reference/Google.Cloud.Firestore.V1/3.8.0/Google.Cloud.Firestore.V1.BloomFilter)\n- [3.7.0](/dotnet/docs/reference/Google.Cloud.Firestore.V1/3.7.0/Google.Cloud.Firestore.V1.BloomFilter)\n- [3.6.0](/dotnet/docs/reference/Google.Cloud.Firestore.V1/3.6.0/Google.Cloud.Firestore.V1.BloomFilter)\n- [3.5.1](/dotnet/docs/reference/Google.Cloud.Firestore.V1/3.5.1/Google.Cloud.Firestore.V1.BloomFilter)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.Firestore.V1/3.4.0/Google.Cloud.Firestore.V1.BloomFilter)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.Firestore.V1/3.3.0/Google.Cloud.Firestore.V1.BloomFilter)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.Firestore.V1/3.2.0/Google.Cloud.Firestore.V1.BloomFilter)\n- [3.1.0](/dotnet/docs/reference/Google.Cloud.Firestore.V1/3.1.0/Google.Cloud.Firestore.V1.BloomFilter)\n- [3.0.0](/dotnet/docs/reference/Google.Cloud.Firestore.V1/3.0.0/Google.Cloud.Firestore.V1.BloomFilter)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.Firestore.V1/2.5.0/Google.Cloud.Firestore.V1.BloomFilter)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Firestore.V1/2.4.0/Google.Cloud.Firestore.V1.BloomFilter)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.Firestore.V1/2.3.0/Google.Cloud.Firestore.V1.BloomFilter) \n\n public sealed class BloomFilter : IMessage\u003cBloomFilter\u003e, IEquatable\u003cBloomFilter\u003e, IDeepCloneable\u003cBloomFilter\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Firestore v1 API class BloomFilter.\n\nA bloom filter (\u003chttps://en.wikipedia.org/wiki/Bloom_filter\u003e).\n\nThe bloom filter hashes the entries with MD5 and treats the resulting 128-bit\nhash as 2 distinct 64-bit hash values, interpreted as unsigned integers\nusing 2's complement encoding.\n\nThese two hash values, named `h1` and `h2`, are then used to compute the\n`hash_count` hash values using the formula, starting at `i=0`: \n\n h(i) = h1 + (i * h2)\n\nThese resulting values are then taken modulo the number of bits in the bloom\nfilter to get the bits of the bloom filter to test for the given entry. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e BloomFilter \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[BloomFilter](/dotnet/docs/reference/Google.Cloud.Firestore.V1/latest/Google.Cloud.Firestore.V1.BloomFilter), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[BloomFilter](/dotnet/docs/reference/Google.Cloud.Firestore.V1/latest/Google.Cloud.Firestore.V1.BloomFilter), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[BloomFilter](/dotnet/docs/reference/Google.Cloud.Firestore.V1/latest/Google.Cloud.Firestore.V1.BloomFilter), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Firestore.V1](/dotnet/docs/reference/Google.Cloud.Firestore.V1/latest/Google.Cloud.Firestore.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Firestore.V1.dll\n\nConstructors\n------------\n\n### BloomFilter()\n\n public BloomFilter()\n\n### BloomFilter(BloomFilter)\n\n public BloomFilter(BloomFilter other)\n\nProperties\n----------\n\n### Bits\n\n public BitSequence Bits { get; set; }\n\nThe bloom filter data.\n\n### HashCount\n\n public int HashCount { get; set; }\n\nThe number of hashes used by the algorithm."]]