# Interface FindNearestOrBuilder (3.1.0)

3.1.0 (latest) 2.40.0 2.37.0 2.36.0 2.34.0 2.33.3 2.32.3 2.31.4 2.30.0 2.29.1 2.28.2 2.27.1 2.26.4 2.25.2 2.24.3 2.23.0 2.22.0 2.21.3 2.20.2 2.19.2 2.18.5 2.17.6

    public interface FindNearestOrBuilder extends MessageOrBuilder

## Implements

[MessageOrBuilder](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.MessageOrBuilder.html)

## Methods

### getDistanceMeasure()

    public abstract FindNearest.DistanceMeasure getDistanceMeasure()

Required. The Distance Measure to use, required.

`
.google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.v1.FindNearest.DistanceMeasure` | The distanceMeasure. |

### getDistanceMeasureValue()

    public abstract int getDistanceMeasureValue()

Required. The Distance Measure to use, required.

`
.google.datastore.v1.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | The enum numeric value on the wire for distanceMeasure. |

### getDistanceResultProperty()

    public abstract String getDistanceResultProperty()

Optional. Optional name of the field to output the result of the vector
distance calculation. Must conform to entity property limitations.

`string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The distanceResultProperty. |

### getDistanceResultPropertyBytes()

    public abstract ByteString getDistanceResultPropertyBytes()

Optional. Optional name of the field to output the result of the vector
distance calculation. Must conform to entity property limitations.

`string distance_result_property = 5 [(.google.api.field_behavior) = OPTIONAL];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes for distanceResultProperty. |

### getDistanceThreshold()

    public abstract DoubleValue getDistanceThreshold()

Optional. Option to specify a threshold for which no less similar documents
will be returned. The behavior of the specified `distance_measure` will
affect the meaning of the distance threshold. Since DOT_PRODUCT distances
increase when the vectors are more similar, the comparison is inverted.

For EUCLIDEAN, COSINE: WHERE distance \<= distance_threshold
For DOT_PRODUCT: WHERE distance \>= distance_threshold

`
.google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.DoubleValue.html` | The distanceThreshold. |

### getDistanceThresholdOrBuilder()

    public abstract DoubleValueOrBuilder getDistanceThresholdOrBuilder()

Optional. Option to specify a threshold for which no less similar documents
will be returned. The behavior of the specified `distance_measure` will
affect the meaning of the distance threshold. Since DOT_PRODUCT distances
increase when the vectors are more similar, the comparison is inverted.

For EUCLIDEAN, COSINE: WHERE distance \<= distance_threshold
For DOT_PRODUCT: WHERE distance \>= distance_threshold

`
.google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.DoubleValueOrBuilder.html` |   |

### getLimit()

    public abstract Int32Value getLimit()

Required. The number of nearest neighbors to return. Must be a positive
integer of no more than 100.

`.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Int32Value.html` | The limit. |

### getLimitOrBuilder()

    public abstract Int32ValueOrBuilder getLimitOrBuilder()

Required. The number of nearest neighbors to return. Must be a positive
integer of no more than 100.

`.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Int32ValueOrBuilder.html` |   |

### getQueryVector()

    public abstract Value getQueryVector()

Required. The query vector that we are searching on. Must be a vector of no
more than 2048 dimensions.

`.google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.v1.Value` | The queryVector. |

### getQueryVectorOrBuilder()

    public abstract ValueOrBuilder getQueryVectorOrBuilder()

Required. The query vector that we are searching on. Must be a vector of no
more than 2048 dimensions.

`.google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.v1.ValueOrBuilder` |   |

### getVectorProperty()

    public abstract PropertyReference getVectorProperty()

Required. An indexed vector property to search upon. Only documents which
contain vectors whose dimensionality match the query_vector can be
returned.

`
.google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.v1.PropertyReference` | The vectorProperty. |

### getVectorPropertyOrBuilder()

    public abstract PropertyReferenceOrBuilder getVectorPropertyOrBuilder()

Required. An indexed vector property to search upon. Only documents which
contain vectors whose dimensionality match the query_vector can be
returned.

`
.google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.v1.PropertyReferenceOrBuilder` |   |

### hasDistanceThreshold()

    public abstract boolean hasDistanceThreshold()

Optional. Option to specify a threshold for which no less similar documents
will be returned. The behavior of the specified `distance_measure` will
affect the meaning of the distance threshold. Since DOT_PRODUCT distances
increase when the vectors are more similar, the comparison is inverted.

For EUCLIDEAN, COSINE: WHERE distance \<= distance_threshold
For DOT_PRODUCT: WHERE distance \>= distance_threshold

`
.google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | Whether the distanceThreshold field is set. |

### hasLimit()

    public abstract boolean hasLimit()

Required. The number of nearest neighbors to return. Must be a positive
integer of no more than 100.

`.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | Whether the limit field is set. |

### hasQueryVector()

    public abstract boolean hasQueryVector()

Required. The query vector that we are searching on. Must be a vector of no
more than 2048 dimensions.

`.google.datastore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | Whether the queryVector field is set. |

### hasVectorProperty()

    public abstract boolean hasVectorProperty()

Required. An indexed vector property to search upon. Only documents which
contain vectors whose dimensionality match the query_vector can be
returned.

`
.google.datastore.v1.PropertyReference vector_property = 1 [(.google.api.field_behavior) = REQUIRED];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | Whether the vectorProperty field is set. |