Dynamic JSON APi Queries

Hi Wappler team,

So I’m at a complex part of my project we are transferring to Wappler.

Right now, we have an API that calls ElasticSearch. ES uses DSL Query language - so we need to send what appears to me quite complex nested JSON queries. This is all handled on the SC side - no API source etc. on the front end.

I have 29 + form fields which hold the users inputs, they have the ability to use multiple queries in each field, use all 29+ form fields, or just use some currently.

In our current build (built by dev team) when they use a field, the whole JSON section of that field with nested requirements is then added to the full JSON query dynamically.

So, if they only use one field, it’s a fairly short query, if they use 5 then the other 4 get added one at a time each time calling ES with the new query.

Here is an example single query:

GET /_search
{
  "query": {
    "bool": {
      "filter": {
        "script": {
          "script": {
            "source": "doc['num1'].value > params.param1",
            "lang": "painless",
            "params": {
              "param1": 5
            }
          }
        }
      }
    }
  }
}

I have the connection returning results from ES - but have not been able to figure out if it’s even possible to do this in Wappler as per our current setup.

@Teodor @George - sorry for tagging but I really need to understand if the above is even possible in Wappler, if it is - how I would do it and if it’s not - what would be a Wappler workaround? (without custom code).

On the SC side there is the query builder - but this appears mostly sql if i’m right - I thought to potentially add the JSON for each field in the value section but that caused an error. I have tried using the JSON type and entering the full (and working query) from our existing app - but it doesn’t cause any result changes.

Please help! I don’t want to go too far if it’s not possible.

Community Page
Last updated: