﻿---
title: IDs
description: Returns documents based on their IDs. This query uses document IDs stored in the _id field. 
url: https://www.elastic.co/elastic/docs-builder/docs/2841/reference/query-languages/query-dsl/query-dsl-ids-query
products:
  - Elasticsearch
---

# IDs
Returns documents based on their IDs. This query uses document IDs stored in the [`_id`](https://www.elastic.co/elastic/docs-builder/docs/2841/reference/elasticsearch/mapping-reference/mapping-id-field) field.

## Example request

```json

{
  "query": {
    "ids" : {
      "values" : ["1", "4", "100"]
    }
  }
}
```


## Top-level parameters for `ids`

<definitions>
  <definition term="values">
    (Required, array of strings) An array of [document IDs](https://www.elastic.co/elastic/docs-builder/docs/2841/reference/elasticsearch/mapping-reference/mapping-id-field).
  </definition>
</definitions>