# Getting 504 on using aggs

**URL:** <https://discuss.elastic.co/t/getting-504-on-using-aggs/246807>\
**Category:** Elasticsearch\
**Created:** [August 28, 2020, 6:01pm UTC](https://discuss.elastic.co/t/getting-504-on-using-aggs/246807 "2020-08-28T18:01:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rishav\_agarwal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rishav_agarwal/32/74723_2.png) [@rishav\_agarwal](https://discuss.elastic.co/u/rishav_agarwal)\
**Post date:** [August 28, 2020, 6:01pm UTC](https://discuss.elastic.co/t/getting-504-on-using-aggs/246807/1 "2020-08-28T18:01:38Z")

</div>

Hi,

I am a new ES user, I type the following query, I get back results:

```auto
POST /test_index/_search
{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "id": "123456"
          }
        }
      ]
    }
  }
}

```

However, when I add a aggs criteria:

```auto
POST /test_index/_search
{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "id": "123456"
          }
        }
      ]
    }
  },
  "aggs": {
    "totalByCat": {
      "terms": {
        "field": "aggField"
      }
    }
  }
}

```

I get 504 Gateway Time-out.

Can anyone please help on how I can debug and fix the issue?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 31, 2020, 3:36am UTC](https://discuss.elastic.co/t/getting-504-on-using-aggs/246807/2 "2020-08-31T03:36:54Z")

</div>

Can you post the entire error you are getting?

---

<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 28, 2020, 3:36am UTC](https://discuss.elastic.co/t/getting-504-on-using-aggs/246807/3 "2020-09-28T03:36:56Z")

</div>

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