# "Starts with" metadata filter

**URL:** <https://community.pinecone.io/t/starts-with-metadata-filter/3579>\
**Category:** Feature Requests\
**Created:** [November 2, 2023, 10:55am UTC](https://community.pinecone.io/t/starts-with-metadata-filter/3579 "2023-11-02T10:55:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jasper](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/jasper/32/4514_2.png) [@Jasper](https://community.pinecone.io/u/Jasper)\
**Post date:** [November 2, 2023, 10:55am UTC](https://community.pinecone.io/t/starts-with-metadata-filter/3579/1 "2023-11-02T10:55:19Z")

</div>

A full regex metadata filter would be nice, but a simpler “starts with” would be very nice for a start.

---

<div class="post-metadata">

**Author:** ![gdj0nes](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/gdj0nes/32/223_2.png) [@gdj0nes](https://community.pinecone.io/u/gdj0nes)\
**Post date:** [December 1, 2023, 9:40pm UTC](https://community.pinecone.io/t/starts-with-metadata-filter/3579/2 "2023-12-01T21:40:32Z")

</div>

Thanks for sharing! What sort of use case do you have for “starts\_with” queries.

---

<div class="post-metadata">

**Author:** ![Jasper](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/jasper/32/4514_2.png) [@Jasper](https://community.pinecone.io/u/Jasper)\
**Post date:** [December 4, 2023, 9:04am UTC](https://community.pinecone.io/t/starts-with-metadata-filter/3579/3 "2023-12-04T09:04:36Z")

</div>

Hmm let me see if I can remember. I think I had a metadata field that contained three or four properties that I wouldn’t want to have as separate metadata fields. So an “ID” field would include document\_type, page\_number and some other stuff. They so it happened that I had to update an existing metadata field but only to some document types. (the first part of the “ID” field).

Another instance was that some documents always started with a specific phrase and I had to update some metadata field of only that documents.

I found workarounds, but at the time it look as a good feature to have, as niche as it may be 😃

---

<div class="post-metadata">

**Author:** ![bruno.camara](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/bruno.camara/32/2337_2.png) [@bruno.camara](https://community.pinecone.io/u/bruno.camara)\
**Post date:** [March 28, 2024, 1:02pm UTC](https://community.pinecone.io/t/starts-with-metadata-filter/3579/4 "2024-03-28T13:02:09Z")

</div>

One use case where the “starts\_with” would be helpful is when using Bedrock Knowlege Bases. When importing from the S3 bucket associated with the KB, there’s a metadata field named **x-amz-bedrock-kb-source-uri**. If my bucket keys are organized into “folders”, it would be great to have the capability to filter using “x-amz-bedrock-kb-source-uri starts with s3://my-bucket-name/myfolde1/”

---

<div class="post-metadata">

**Author:** ![norewindz](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/norewindz/32/2366_2.png) [@norewindz](https://community.pinecone.io/u/norewindz)\
**Post date:** [April 1, 2024, 11:34pm UTC](https://community.pinecone.io/t/starts-with-metadata-filter/3579/5 "2024-04-01T23:34:54Z")

</div>

A bit unrelated but I think also a good idea would be a “starts with” vector id filter.

In the delete docs, pinecone suggests prefixing ids with a unique id.

If we can delete like this, why can we not query? We don’t need to worry about metadata cardinality this way.

Also i think it is important that we can query starts with with an array, so we can search through multiple vectors matching. Basically a metadata filter, but the metadata is the prefixed-id of the vectors!

A potential issue with starts with is overlapping ids, which could bring in unwanted results, so it isn’t perfect! But a simple fix would be check starts with idprefix\_? Hmmm

Would it be computationally expensive to check every metadata/id starts with? Maybe this is why we can only simply apply a filter on metadata

---

<div class="post-metadata">

**Author:** ![norewindz](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/norewindz/32/2366_2.png) [@norewindz](https://community.pinecone.io/u/norewindz)\
**Post date:** [April 1, 2024, 11:39pm UTC](https://community.pinecone.io/t/starts-with-metadata-filter/3579/6 "2024-04-01T23:39:09Z")

</div>

In the docs for delete with id prefix, there is no starts with.

Users should store the id prefix and chunk total themselves and assemble the delete batch operation.

So there is currently no starts with support. I think it must be computationally expensive!
