# Query entities

Read rows matching a scalar filter. Supply a limit when reading without a filter.

SDK: `@zilliz/milvus2-sdk-node@3.0.10` · Tested with Milvus 3.0.6

Canonical documentation: https://milvus-io.github.io/milvus-sdk-node/rest-api/entities/query/

## Section links

- [cURL command](https://milvus-io.github.io/milvus-sdk-node/rest-api/entities/query/#curl-command)
- [Default request](https://milvus-io.github.io/milvus-sdk-node/rest-api/entities/query/#default-request)
- [Sample response](https://milvus-io.github.io/milvus-sdk-node/rest-api/entities/query/#sample-response)
- [Request fields](https://milvus-io.github.io/milvus-sdk-node/rest-api/entities/query/#request-fields)

`POST /v2/vectordb/entities/query`

Replace `https://your-cluster.example.com` with your Milvus endpoint. Set `MILVUS_TOKEN` for authentication or omit the Authorization header on an unauthenticated cluster.

## cURL command

```bash
curl --request POST --url 'https://your-cluster.example.com/v2/vectordb/entities/query' \
  --header 'Content-Type: application/json' \
  --header "Authorization: Bearer ${MILVUS_TOKEN}" \
  --data-raw '{
  "dbName": "default",
  "collectionName": "books",
  "outputFields": [
    "title"
  ],
  "limit": 5
}'
```

## Default request

```json
{
  "dbName": "default",
  "collectionName": "books",
  "outputFields": [
    "title"
  ],
  "limit": 5
}
```

## Sample response

```json
{
  "code": 0,
  "data": [
    {
      "id": 101,
      "title": "Invisible Cities"
    }
  ],
  "cost": 0
}
```

## Request fields

- `dbName` string
  Database name. Operations on collections use default when omitted.
- `collectionName` string (required)
  Name of the collection.
- `partitionNames` array of string
  Names of the partitions to target.
- `outputFields` array of string
  Field names to include in the returned entities.
- `filter` string
  Milvus scalar filter expression.
- `limit` integer
  Maximum number of rows or hits per query input.
- `offset` integer
  Number of matching results to skip.
- `orderByFields` array of string
  Field ordering expressions for sorted results.
- `groupByFields` array of string
  Fields used to group query results.
- `exprParams` object
  Values for placeholders in a filter expression.
- `consistencyLevel` string
  Read consistency level, such as Strong, Session, or Bounded.

See [`HttpClient.query`](https://milvus-io.github.io/milvus-sdk-node/api-reference/http-client/#query) for the Node.js SDK method.
