# Filtering with JSON Path (Postgres)

**URL:** <https://forum.elixirforum.com/t/filtering-with-json-path-postgres/68386>\
**Category:** Questions\
**Tags:** ash, ash-postgres\
**Created:** [December 27, 2024, 6:48am UTC](https://forum.elixirforum.com/t/filtering-with-json-path-postgres/68386 "2024-12-27T06:48:54Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![westbaystars](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/w/58f4c7/32.png) [@westbaystars](https://forum.elixirforum.com/u/westbaystars)\
**Post date:** [December 28, 2024, 5:08am UTC](https://forum.elixirforum.com/t/filtering-with-json-path-postgres/68386/6 "2024-12-28T05:08:34Z")

</div>

> [@zachdaniel](#):
>
> ```elixir
> prepare fn query, _context ->
> jsonpath = "'($[*].surname like_regex \"^#{query.arguments.search_name}\" flag \"i\") || ($[*].given_name like_regex \"^#{query.arguments.search_name}\" flag \"i\")'"
> 
> Ash.Query.filter(query, fragment("to_json(names)::jsonb @@ ?::unknown", ^jsonpath))
> end
> 
> ```

Thank you for the prompt response. However, that also didn’t work.

I’m now looking into how to create a function on the PSQL side that will do do it.

Thank you for your time.

Take care.

---

_[View the full topic](https://forum.elixirforum.com/t/filtering-with-json-path-postgres/68386)._
