Ash FrameworkAF
Ash Framework3mo ago
2 replies
fs4k

Keyword list filters on json fields

I want to understand more about keyword list filters, specifically how to filter on fragments
Suppose I have a
user
resource with one-to-many relationship with posts.
I want to count posts for each user by filtering on the post's metadata column.
Something like
Ash.Query.Aggregate.new!(User, name, :count,
  path: [:posts],
  query: [filter: [
    "meta->>'published'": "yes",
  ]]
)

But this is not correct format for keyword list filters. Is there a way to do this?
Solution
Figured it out. If I define a published calculation, I can use it in the keyword list, like filter: [published: "yes"]
Was this page helpful?