# Query Terms limit error

**URL:** <https://discuss.elastic.co/t/query-terms-limit-error/364948>\
**Category:** Elasticsearch\
**Created:** [August 15, 2024, 10:28am UTC](https://discuss.elastic.co/t/query-terms-limit-error/364948 "2024-08-15T10:28:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cahl](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@cahl](https://discuss.elastic.co/u/cahl)\
**Post date:** [August 15, 2024, 10:28am UTC](https://discuss.elastic.co/t/query-terms-limit-error/364948/1 "2024-08-15T10:28:56Z")

</div>

I read the terms is limited to around 65k on the default config. However, I am trying to make a query with around 2k values in the terms and it is failing. I notice if I use 665 works fine but if I add an extra value it fails and the error displayed does not help:

```auto
{"statusCode":400,"error":"Bad Request","message":"[request query.method]: Method must be one of, case insensitive ['HEAD', 'GET', 'POST', 'PUT', 'DELETE']. Received '\"as\"'."}

```

Field "as" is defined as long on filebeat index.

```auto
        "as" : {
          "properties" : {
            "number" : {
              "type" : "long"
            },

```

This is the query (suppressing most of the values just for readability reasons):

```auto
POST filebeat-*/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "terms": {
            "as": [135242, 135243, 135244, 135245]
            }
          }
        ]
      }
  }
}

```

I also tried similar query with a keyword field and faced the same issue. I am using Elastic Cloud and the version is 7.17.6.

Any ideas why I cannot use a higher number of elements in the terms?

Regards,  
Cesar

---

<div class="post-metadata">

**Author:** ![cahl](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@cahl](https://discuss.elastic.co/u/cahl)\
**Post date:** [August 15, 2024, 10:29am UTC](https://discuss.elastic.co/t/query-terms-limit-error/364948/2 "2024-08-15T10:29:30Z")

</div>

Removed #elastic-cloud
