I found the sample like that on here : deangit/brandy · GitHub
Amri thank you, this is outstanding work. This is perfect and exactly what we are looking for! It even works with the current API. I may look into basing my code of this if Dean is okay with it (will keep all credits in comments, credit in the release, etc). It's quite self-contained. It will have to be refactored significantly, to output the results (featureSet) to the WebApp Builder attribute table, for example. Would be nice to dijitify the Query builder buttons, although just wiring to jimu classes may be fine.
Retrieving data ...