i don’t know if you found this thread yet Dynamic Queries in Ecto If not dynamic ecto queries may be your answer.