Send feedback
Enum FindNearest.DistanceMeasure (2.31.4)
Stay organized with collections
Save and categorize content based on your preferences.
Version latestkeyboard_arrow_down
public enum FindNearest . DistanceMeasure extends Enum<FindNearest . DistanceMeasure > implements ProtocolMessageEnum
The distance measure to use when comparing vectors.
Protobuf enum google.datastore.v1.FindNearest.DistanceMeasure
Static Fields
Name
Description
COSINE
COSINE distance compares vectors based on the angle between them, which
allows you to measure similarity that isn't based on the vectors
magnitude. We recommend using DOT_PRODUCT with unit normalized vectors
instead of COSINE distance, which is mathematically equivalent with
better performance. See Cosine
Similarity to learn
more about COSINE similarity and COSINE distance. The resulting COSINE
distance decreases the more similar two vectors are.
COSINE = 2;
COSINE_VALUE
COSINE distance compares vectors based on the angle between them, which
allows you to measure similarity that isn't based on the vectors
magnitude. We recommend using DOT_PRODUCT with unit normalized vectors
instead of COSINE distance, which is mathematically equivalent with
better performance. See Cosine
Similarity to learn
more about COSINE similarity and COSINE distance. The resulting COSINE
distance decreases the more similar two vectors are.
COSINE = 2;
DISTANCE_MEASURE_UNSPECIFIED
Should not be set.
DISTANCE_MEASURE_UNSPECIFIED = 0;
DISTANCE_MEASURE_UNSPECIFIED_VALUE
Should not be set.
DISTANCE_MEASURE_UNSPECIFIED = 0;
DOT_PRODUCT
Similar to cosine but is affected by the magnitude of the vectors. See
Dot Product to learn more.
The resulting distance increases the more similar two vectors are.
DOT_PRODUCT = 3;
DOT_PRODUCT_VALUE
Similar to cosine but is affected by the magnitude of the vectors. See
Dot Product to learn more.
The resulting distance increases the more similar two vectors are.
DOT_PRODUCT = 3;
EUCLIDEAN
Measures the EUCLIDEAN distance between the vectors. See
Euclidean to learn
more. The resulting distance decreases the more similar two vectors are.
EUCLIDEAN = 1;
EUCLIDEAN_VALUE
Measures the EUCLIDEAN distance between the vectors. See
Euclidean to learn
more. The resulting distance decreases the more similar two vectors are.
EUCLIDEAN = 1;
UNRECOGNIZED
Static Methods
Name
Description
forNumber(int value)
getDescriptor()
internalGetValueMap()
valueOf(Descriptors.EnumValueDescriptor desc)
valueOf(int value)
Deprecated. Use #forNumber(int) instead.
valueOf(String name)
values()
Methods
Name
Description
getDescriptorForType()
getNumber()
getValueDescriptor()
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-04 UTC.
Need to tell us more?
[[["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-09-04 UTC."],[],[],null,["# Enum FindNearest.DistanceMeasure (2.31.2)\n\nVersion latestkeyboard_arrow_down\n\n- [2.31.2 (latest)](/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.v1.FindNearest.DistanceMeasure)\n- [2.31.1](/java/docs/reference/google-cloud-datastore/2.31.1/com.google.datastore.v1.FindNearest.DistanceMeasure)\n- [2.30.0](/java/docs/reference/google-cloud-datastore/2.30.0/com.google.datastore.v1.FindNearest.DistanceMeasure)\n- [2.29.1](/java/docs/reference/google-cloud-datastore/2.29.1/com.google.datastore.v1.FindNearest.DistanceMeasure)\n- [2.28.2](/java/docs/reference/google-cloud-datastore/2.28.2/com.google.datastore.v1.FindNearest.DistanceMeasure)\n- [2.27.1](/java/docs/reference/google-cloud-datastore/2.27.1/com.google.datastore.v1.FindNearest.DistanceMeasure)\n- [2.26.4](/java/docs/reference/google-cloud-datastore/2.26.4/com.google.datastore.v1.FindNearest.DistanceMeasure)\n- [2.25.2](/java/docs/reference/google-cloud-datastore/2.25.2/com.google.datastore.v1.FindNearest.DistanceMeasure)\n- [2.24.3](/java/docs/reference/google-cloud-datastore/2.24.3/com.google.datastore.v1.FindNearest.DistanceMeasure)\n- [2.23.0](/java/docs/reference/google-cloud-datastore/2.23.0/com.google.datastore.v1.FindNearest.DistanceMeasure)\n- [2.22.0](/java/docs/reference/google-cloud-datastore/2.22.0/com.google.datastore.v1.FindNearest.DistanceMeasure)\n- [2.21.3](/java/docs/reference/google-cloud-datastore/2.21.3/com.google.datastore.v1.FindNearest.DistanceMeasure)\n- [2.20.2](/java/docs/reference/google-cloud-datastore/2.20.2/com.google.datastore.v1.FindNearest.DistanceMeasure)\n- [2.19.2](/java/docs/reference/google-cloud-datastore/2.19.2/com.google.datastore.v1.FindNearest.DistanceMeasure)\n- [2.18.5](/java/docs/reference/google-cloud-datastore/2.18.5/com.google.datastore.v1.FindNearest.DistanceMeasure)\n- [2.17.6](/java/docs/reference/google-cloud-datastore/2.17.6/com.google.datastore.v1.FindNearest.DistanceMeasure) \n\n public enum FindNearest.DistanceMeasure extends Enum\u003cFindNearest.DistanceMeasure\u003e implements ProtocolMessageEnum\n\nThe distance measure to use when comparing vectors.\n\nProtobuf enum `google.datastore.v1.FindNearest.DistanceMeasure` \n\nImplements\n----------\n\n[ProtocolMessageEnum](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ProtocolMessageEnum.html) \n\nInherited Members\n-----------------\n\n[Enum.\\\u003cT\\\u003evalueOf(Class\\\u003cT\\\u003e,String)](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#valueOf-java.lang.Class-java.lang.String-) \n[Enum.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#clone--) \n[Enum.compareTo(E)](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#compareTo-E-) \n[Enum.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#equals-java.lang.Object-) \n[Enum.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#finalize--) \n[Enum.getDeclaringClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#getDeclaringClass--) \n[Enum.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#hashCode--) \n[Enum.name()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#name--) \n[Enum.ordinal()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#ordinal--) \n[Enum.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html#toString--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)"]]