Flop - Filtering, sorting and pagination for Ecto

You should be able to solve this using custom fields or join fields.

If you use join fields, you can add a lateral join on a sub query to your query. In the sub query, you can try to use json_to_record or json_populate_record to unpack the metadata.

If you use custom fields, you can use the → operator without joining. The drawback is that you’ll have to implement the query for each filter operator you need to support manually.