The properties to make distinct. The query results will contain the first result for each distinct combination of values for the given properties (if empty, all results are returned). Requires: * * Iforderis specified, the set of distinct on properties must appear before the non-distinct on properties inorder.
The maximum number of results to return. Applies after all other constraints. Optional. Unspecified is interpreted as no limit. Must be >= 0 if specified.
Optional. A potential Nearest Neighbors Search. Applies after all other filters and ordering. Finds the closest vector embeddings to the given query vector.
getProjection
The projection to return. Defaults to returning all properties.
The properties to make distinct. The query results will contain the first
result for each distinct combination of values for the given properties
(if empty, all results are returned).
Requires:
Iforderis specified, the set of distinct on properties must appear
before the non-distinct on properties inorder.
The properties to make distinct. The query results will contain the first
result for each distinct combination of values for the given properties
(if empty, all results are returned).
Requires:
Iforderis specified, the set of distinct on properties must appear
before the non-distinct on properties inorder.
The maximum number of results to return. Applies after all other
constraints. Optional.
Unspecified is interpreted as no limit.
Must be >= 0 if specified.
Returns
Type
Description
int|null
setLimit
The maximum number of results to return. Applies after all other
constraints. Optional.
Unspecified is interpreted as no limit.
Must be >= 0 if specified.
Sets the field by wrapping a primitive type in a Google\Protobuf\Int32Value object.
The maximum number of results to return. Applies after all other
constraints. Optional.
Unspecified is interpreted as no limit.
Must be >= 0 if specified.
Parameter
Name
Description
var
int|null
Returns
Type
Description
$this
getFindNearest
Optional. A potential Nearest Neighbors Search.
Applies after all other filters and ordering.
Finds the closest vector embeddings to the given query vector.
[[["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,["# Cloud Datastore V1 Client - Class Query (1.33.1)\n\nVersion latestkeyboard_arrow_down\n\n- [1.33.1 (latest)](/php/docs/reference/cloud-datastore/latest/V1.Query)\n- [1.33.0](/php/docs/reference/cloud-datastore/1.33.0/V1.Query)\n- [1.32.3](/php/docs/reference/cloud-datastore/1.32.3/V1.Query)\n- [1.31.0](/php/docs/reference/cloud-datastore/1.31.0/V1.Query)\n- [1.30.0](/php/docs/reference/cloud-datastore/1.30.0/V1.Query)\n- [1.29.2](/php/docs/reference/cloud-datastore/1.29.2/V1.Query)\n- [1.28.2](/php/docs/reference/cloud-datastore/1.28.2/V1.Query)\n- [1.26.0](/php/docs/reference/cloud-datastore/1.26.0/V1.Query)\n- [1.25.0](/php/docs/reference/cloud-datastore/1.25.0/V1.Query)\n- [1.24.4](/php/docs/reference/cloud-datastore/1.24.4/V1.Query)\n- [1.23.0](/php/docs/reference/cloud-datastore/1.23.0/V1.Query)\n- [1.22.1](/php/docs/reference/cloud-datastore/1.22.1/V1.Query)\n- [1.21.2](/php/docs/reference/cloud-datastore/1.21.2/V1.Query)\n- [1.19.0](/php/docs/reference/cloud-datastore/1.19.0/V1.Query)\n- [1.18.1](/php/docs/reference/cloud-datastore/1.18.1/V1.Query)\n- [1.17.1](/php/docs/reference/cloud-datastore/1.17.1/V1.Query) \nReference documentation and code samples for the Cloud Datastore V1 Client class Query.\n\nA query for entities.\n\nThe query stages are executed in the following order:\n\n1. kind\n2. filter\n3. projection\n4. order + start_cursor + end_cursor\n5. offset\n6. limit\n7. find_nearest\n\nGenerated from protobuf message `google.datastore.v1.Query`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Datastore \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getProjection\n\nThe projection to return. Defaults to returning all properties.\n\n### setProjection\n\nThe projection to return. Defaults to returning all properties.\n\n### getKind\n\nThe kinds to query (if empty, returns entities of all kinds).\n\nCurrently at most 1 kind may be specified.\n\n### setKind\n\nThe kinds to query (if empty, returns entities of all kinds).\n\nCurrently at most 1 kind may be specified.\n\n### getFilter\n\nThe filter to apply.\n\n### hasFilter\n\n### clearFilter\n\n### setFilter\n\nThe filter to apply.\n\n### getOrder\n\nThe order to apply to the query results (if empty, order is unspecified).\n\n### setOrder\n\nThe order to apply to the query results (if empty, order is unspecified).\n\n### getDistinctOn\n\nThe properties to make distinct. The query results will contain the first\nresult for each distinct combination of values for the given properties\n(if empty, all results are returned).\n\nRequires:\n\n- If `order` is specified, the set of distinct on properties must appear before the non-distinct on properties in `order`.\n\n### setDistinctOn\n\nThe properties to make distinct. The query results will contain the first\nresult for each distinct combination of values for the given properties\n(if empty, all results are returned).\n\nRequires:\n\n- If `order` is specified, the set of distinct on properties must appear before the non-distinct on properties in `order`.\n\n### getStartCursor\n\nA starting point for the query results. Query cursors are\nreturned in query result batches and\n[can only be used to continue the same\nquery](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets).\n\n### setStartCursor\n\nA starting point for the query results. Query cursors are\nreturned in query result batches and\n[can only be used to continue the same\nquery](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets).\n\n### getEndCursor\n\nAn ending point for the query results. Query cursors are\nreturned in query result batches and\n[can only be used to limit the same\nquery](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets).\n\n### setEndCursor\n\nAn ending point for the query results. Query cursors are\nreturned in query result batches and\n[can only be used to limit the same\nquery](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets).\n\n### getOffset\n\nThe number of results to skip. Applies before limit, but after all other\nconstraints. Optional. Must be \\\u003e= 0 if specified.\n\n### setOffset\n\nThe number of results to skip. Applies before limit, but after all other\nconstraints. Optional. Must be \\\u003e= 0 if specified.\n\n### getLimit\n\nThe maximum number of results to return. Applies after all other\nconstraints. Optional.\n\nUnspecified is interpreted as no limit.\nMust be \\\u003e= 0 if specified.\n\n### hasLimit\n\n### clearLimit\n\n### getLimitValue\n\nReturns the unboxed value from `getLimit()`\n\nThe maximum number of results to return. Applies after all other\nconstraints. Optional.\nUnspecified is interpreted as no limit.\nMust be \\\u003e= 0 if specified.\n\n### setLimit\n\nThe maximum number of results to return. Applies after all other\nconstraints. Optional.\n\nUnspecified is interpreted as no limit.\nMust be \\\u003e= 0 if specified.\n\n### setLimitValue\n\nSets the field by wrapping a primitive type in a Google\\\\Protobuf\\\\Int32Value object.\n\nThe maximum number of results to return. Applies after all other\nconstraints. Optional.\nUnspecified is interpreted as no limit.\nMust be \\\u003e= 0 if specified.\n\n### getFindNearest\n\nOptional. A potential Nearest Neighbors Search.\n\nApplies after all other filters and ordering.\nFinds the closest vector embeddings to the given query vector.\n\n### hasFindNearest\n\n### clearFindNearest\n\n### setFindNearest\n\nOptional. A potential Nearest Neighbors Search.\n\nApplies after all other filters and ordering.\nFinds the closest vector embeddings to the given query vector."]]