# Unpredictable work of terminate\_after

**URL:** <https://discuss.elastic.co/t/unpredictable-work-of-terminate-after/281306>\
**Category:** Elasticsearch\
**Created:** [August 13, 2021, 7:20am UTC](https://discuss.elastic.co/t/unpredictable-work-of-terminate-after/281306 "2021-08-13T07:20:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![romanenkoss](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/romanenkoss/32/92956_2.png) [@romanenkoss](https://discuss.elastic.co/u/romanenkoss)\
**Post date:** [August 13, 2021, 7:20am UTC](https://discuss.elastic.co/t/unpredictable-work-of-terminate-after/281306/1 "2021-08-13T07:20:28Z")

</div>

Hi team,  
I have an index with 4 billion docs, 200 shards, I want to use terminate\_after=500000 if I correctly understood request must terminate after 100kk docs, when the count of docs is more than 100kk it's working fine, but when 93-99 kk request terminates too, can you give me an advice what I am doing wrong? Or is it a bug? I use Elasticsearch 7.10.0.

```auto
{
	"query": {
		"bool": {
			"should": [
				{
					"match": {
						"name": {
							"boost": 1000,
							"query": "g"
						}
					}
				},
				{
					"prefix": {
						"name_full_reverse": {
							"boost": 100,
							"value": "g"
						}
					}
				},
				{
					"multi_match": {
						"fields": [],
						"query": "g"
					}
				}
			]
		}
	}
}

/_count?terminate_after=500000
{
  "terminated_early": true,
  "count": 93705326,
  "_shards": {
    "total": 200,
    "successful": 200,
    "skipped": 0,
    "failed": 0
  }
}

/_count
{
  "count": 98221798,
  "_shards": {
    "total": 200,
    "successful": 200,
    "skipped": 0,
    "failed": 0
  }
}

```

---

<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:** [September 10, 2021, 7:21am UTC](https://discuss.elastic.co/t/unpredictable-work-of-terminate-after/281306/2 "2021-09-10T07:21:03Z")

</div>

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