# What's the maximum number of terms allowed for an $in or $nin metadata filter query?

**URL:** <https://community.pinecone.io/t/whats-the-maximum-number-of-terms-allowed-for-an-in-or-nin-metadata-filter-query/3598>\
**Category:** General\
**Tags:** semantic-search, vector-database\
**Created:** [November 3, 2023, 8:33pm UTC](https://community.pinecone.io/t/whats-the-maximum-number-of-terms-allowed-for-an-in-or-nin-metadata-filter-query/3598 "2023-11-03T20:33:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![richie](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/richie/32/598_2.png) [@richie](https://community.pinecone.io/u/richie)\
**Post date:** [November 3, 2023, 8:33pm UTC](https://community.pinecone.io/t/whats-the-maximum-number-of-terms-allowed-for-an-in-or-nin-metadata-filter-query/3598/1 "2023-11-03T20:33:40Z")

</div>

## Background

We have an indexed metadata field called `group`. The cardinality of the field is 10,000. We need the ability to query vectors that only match some `group` values, so we’re using the `$in` operator as per:

- [Indexing overview - Pinecone Docs](https://docs.pinecone.io/docs/metadata-filtering#metadata-query-language)

## Problem

The problem is that we need to specify 1,000s of values for the `$in` set. For example:

```json
{
  "group": {"$in":["a1","a2", ..., "a1000"]}
}

```

What are the maximum constraints that apply to a query like this? Is there a maximum number of terms that are allowed for the `$in` set? Is there a maximum byte size for the query? If so what are those limits?

---

<div class="post-metadata">

**Author:** ![jamesbriggs](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/jamesbriggs/32/52_2.png) [@jamesbriggs](https://community.pinecone.io/u/jamesbriggs)\
**Post date:** [November 15, 2023, 2:55pm UTC](https://community.pinecone.io/t/whats-the-maximum-number-of-terms-allowed-for-an-in-or-nin-metadata-filter-query/3598/2 "2023-11-15T14:55:13Z")

</div>

Hi Richie, there is no hard limit on the number of values in your filter. However, there is a 2MB limit on request payload size, so whatever you can fit in there alongside you query vector and other metadata is your actual limit.

Hope that helps!
