# Elasticsearch Get All data which has specified value for some of the field

**URL:** <https://discuss.elastic.co/t/elasticsearch-get-all-data-which-has-specified-value-for-some-of-the-field/334201>\
**Category:** Elasticsearch\
**Created:** [May 24, 2023, 10:05am UTC](https://discuss.elastic.co/t/elasticsearch-get-all-data-which-has-specified-value-for-some-of-the-field/334201 "2023-05-24T10:05:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mustafa\_AYDOGDU](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mustafa_aydogdu/32/119908_2.png) [@Mustafa\_AYDOGDU](https://discuss.elastic.co/u/Mustafa_AYDOGDU)\
**Post date:** [May 24, 2023, 10:05am UTC](https://discuss.elastic.co/t/elasticsearch-get-all-data-which-has-specified-value-for-some-of-the-field/334201/1 "2023-05-24T10:05:39Z")

</div>

Hello,

I have a query which gets data with project\_id=1 and project\_user\_id=1:

```auto
GET /tweet_user_id_index/_search
{
  "query": {
    "bool": {
      "should": [
        {
          "term": {
            "project_id": {
              "value": 1
            }
          }
        },
        {
          "term": {
            "project_user_id": {
              "value": 1
            }
          }
        }
      ]
    }
  }
}

```

But this does not give all results. It returns some of them. How can I get all the data?

---

<div class="post-metadata">

**Author:** ![eMitch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emitch/32/93607_2.png) [@eMitch](https://discuss.elastic.co/u/eMitch)\
**Post date:** [May 24, 2023, 2:22pm UTC](https://discuss.elastic.co/t/elasticsearch-get-all-data-which-has-specified-value-for-some-of-the-field/334201/2 "2023-05-24T14:22:57Z")

</div>

You will want to try and use the [search\_after parameter](https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#search-after) and paginate through all the records.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 21, 2023, 2:23pm UTC](https://discuss.elastic.co/t/elasticsearch-get-all-data-which-has-specified-value-for-some-of-the-field/334201/3 "2023-06-21T14:23:56Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
