# Issue with group by using python client

**URL:** <https://forum.weaviate.io/t/issue-with-group-by-using-python-client/880>\
**Category:** Support\
**Created:** [October 29, 2023, 7:21pm UTC](https://forum.weaviate.io/t/issue-with-group-by-using-python-client/880 "2023-10-29T19:21:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samuel\_Galanakis](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/samuel_galanakis/32/605_2.png) [@Samuel\_Galanakis](https://forum.weaviate.io/u/Samuel_Galanakis)\
**Post date:** [October 29, 2023, 7:21pm UTC](https://forum.weaviate.io/t/issue-with-group-by-using-python-client/880/1 "2023-10-29T19:21:36Z")

</div>

I am trying to return objects grouped by a simple field and have had no luck. Any variation I have tried always seems to essentially ignore the group by and return according to the rest of the query. The “\_additional” field is returned as None. What am I missing?

```auto

result = client.query.get("Chunks", ["text"]) \
    .with_bm25(query="what is cybersecurity") \
    .with_group_by(["page"],groups=2,objects_per_group=2) \
    .with_additional(
	
	"""
	group {
            id
            groupedBy {
                path
                value
            }
            count
			}
			
			"""
	) \
    .with_limit(10) \
    .do()

```

---

<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:** [November 2, 2023, 10:22pm UTC](https://forum.weaviate.io/t/issue-with-group-by-using-python-client/880/2 "2023-11-02T22:22:31Z")

</div>

Hi! Welcome to our community! 🤗

Indeed, I was only able to use group by using the near text (similarity search). Check this notebook out:

> **[Google Colaboratory](https://colab.research.google.com/drive/1UECzrh_hGb3XTwmNrl0HiQeloy_OJ6Yg?authuser=1#scrollTo=Mb5M08AJFkWL)**

I have forwarded this question internally, and will get back here when I have more info.

Thanks!

---

<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:** [November 7, 2023, 12:47pm UTC](https://forum.weaviate.io/t/issue-with-group-by-using-python-client/880/3 "2023-11-07T12:47:08Z")

</div>

Hi! Sorry for the delay here.

Indeed, group by will only work when used with with\_near\_text

Thanks!
