# Efficient way to make filters with multiple operands

**URL:** https://forum.weaviate.io/t/efficient-way-to-make-filters-with-multiple-operands/1176
**Category:** Support
**Created:** [January 5, 2024, 10:29am UTC](https://forum.weaviate.io/t/efficient-way-to-make-filters-with-multiple-operands/1176 "2024-01-05T10:29:47Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Jegadeesh](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@Jegadeesh](https://forum.weaviate.io/u/Jegadeesh)
#### Post date: [January 5, 2024, 10:29am UTC](https://forum.weaviate.io/t/efficient-way-to-make-filters-with-multiple-operands/1176/1 "2024-01-05T10:29:47Z")

</div>

Hi, I am trying to make filters to query with multiple operands using python v4 client. I am combining different filters to make a combined filter at runtime.

for single\_filter in filters:  
combined\_filters = combined\_filters & single\_filter if combined\_filters else single\_filter

I want to add more operands to the filter. Is there any efficient way to make the filters at runtime?

---

<div class="post-metadata">

### Author: ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)
#### Post date: [January 9, 2024, 1:59pm UTC](https://forum.weaviate.io/t/efficient-way-to-make-filters-with-multiple-operands/1176/2 "2024-01-09T13:59:01Z")

</div>

Hi @Jegadeesh !!

I have used this code sample for creating dynamic filters on coderun:

Let me know if this is something you are looking for:

```auto
filter_metal = True

filters = [
    Filter("question").like("*is*"),
    (Filter("count").greater_than(5) & Filter("count").less_than(10))
]

if filter_metal:
    filters.append(Filter("question").like("*metal*"))

combined_filter = reduce(lambda x, y: x & y, filters)

from weaviate.classes import Filter

jeopardy = client.collections.get("Question")
response = jeopardy.query.fetch_objects(
    filters=combined_filter,
    limit=3
)

```
