# How to get all the results from the nested datatype query in Elasticsearch?

**URL:** <https://discuss.elastic.co/t/how-to-get-all-the-results-from-the-nested-datatype-query-in-elasticsearch/187199>\
**Category:** Elasticsearch\
**Created:** [June 24, 2019, 10:27pm UTC](https://discuss.elastic.co/t/how-to-get-all-the-results-from-the-nested-datatype-query-in-elasticsearch/187199 "2019-06-24T22:27:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AmoghM](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amoghm/32/48679_2.png) [@AmoghM](https://discuss.elastic.co/u/AmoghM)\
**Post date:** [June 24, 2019, 10:27pm UTC](https://discuss.elastic.co/t/how-to-get-all-the-results-from-the-nested-datatype-query-in-elasticsearch/187199/1 "2019-06-24T22:27:07Z")

</div>

I am trying to fetch all matching sentences from a blob of text using nested datatype of Elasticsearch. In the query mentioned below, I try to filter all the sentence which have "the" and "of" mentioned in the same sentence.

```auto
GET myindex/doc/_search
{
  "from": 0,
  "size": 1,
  "query": {
    "nested": {
      "path": "parent.data",
      "query": {
        "bool": {
          "filter": [
            {
              "match": {
                "parent.data.sentence": "the"
              }
            },
            {
              "match": {
                "parent.data.sentence": "of"
              }
            }
          ]
        }
      },
      "inner_hits": {}
    }
  }
}

```

Although the response shows, added below, that there are 544 documents in total, only three of them are shown by ES. How can I get to retrieve all of them?

```auto
{
  "took": 709,
  "timed_out": false,
  "_shards": {
    "total": 6,
    "successful": 6,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 73783,
    "max_score": 0,
    "hits": [
      {
        "_index": "my-index",
        "_type": "doc",
        "_id": "bd9e3c03741956db68fd692a6914e811b0749baaf6565c6385380919f1ce3932",
        "_score": 0,
        "_source": {},
        "inner_hits": {
          "parent.data.sentence": {
            "hits": {
              "total": 544,
              "max_score": 0,
              "hits": [<response containing 3 sentence>],
          }
        }
      }
    ]
  }
}

```

---

<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:** [July 22, 2019, 10:27pm UTC](https://discuss.elastic.co/t/how-to-get-all-the-results-from-the-nested-datatype-query-in-elasticsearch/187199/2 "2019-07-22T22:27:16Z")

</div>

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