Description
i.e. object properties whose names aren't known until run time?
to clarify: in plain javascript if I have something like this:
const json = {
"esFields": {
"param1": "esField1.keyword",
"param2": "esField2.keyword"
}
}
it's typical to do just json.esFields.param1 if u know the "param1" part ahead of time
but if if u have a variable param whose value is the "param1" then (idiomatically) u switch to json.esFields[param]
In trying to use JSONata to generate some elasticsearch query json I struggled where I was trying to map input parameter names to elasticsearch field names using an object to do the mapping
This is a simplified equivalent of what I was attempting and the error I was getting (where I realized the square brackets seemingly do not/cannot just take a property name string?)
can this be made to work without $lookup?
I did finally get it working using $lookup like this:
working with $lookup
(but in my mind what I was doing seemed simple mostly I just wanted to confirm there wasn't a simple solution that didn't use the $lookup)