Skip to content

GraphQL Aggregate groupBy filter gives inconsistent result #8

@laura-ham

Description

@laura-ham

Important to note is that the property isAccessible is not filled, so it only has null values.

The following query in plain GraphQL gives the following result:

GraphQL Query:

{
  Aggregate {
    Things {
      Article(groupBy: ["isAccessible"]) {
        meta {
          count
        }
        wordCount {
          mean
        }
        groupedBy {
          value
          path
        }
      }
    }
  }
}

GraphQL Result:

{
  "data": {
    "Aggregate": {
      "Things": {
        "Article": []
      }
    }
  },
  "errors": null
}

Expected is the same output with the JS code, but the result is inconsistent:

JS Query:

const weaviate = require("weaviate-client");

const client = weaviate.client({
  scheme: 'http',
  host: 'localhost:8080',
});

client.graphql
      .aggregate()
      .withClassName('Article')
      .withGroupBy(["isAccessible"])
      .withFields('meta { count } wordCount {mean} groupedBy {value path}')
      .do()
      .then(res => {
        console.log(JSON.stringify(res))
      })
      .catch(err => {
        console.error(err)
      });

JS response:

{
  "data": {
    "Aggregate": {
      "Things": {
        "Article": [
          {
            "groupedBy": null,
            "meta": {
              "count": 2548
            },
            "wordCount": {
              "mean": 1013.82025
            }
          }
        ]
      }
    }
  },
  "errors": null
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions