Suppose I have an object
const aggs = {
cat.id: {
terms: { field: 'cat.id', size: 10 },
aggs: { cat.label: {field: 'cat.label', size: 5} }
}
}
In the dynamic variable I have
const key = '[cat.id].aggs'
Now I need to access the attribute aggs inside aggs object using dynamic variable
aggs[key]
which is not working, How can I access the nested attributes dynamically? Obviously accessing it directly like this works
aggs['cat.id'].aggs
[cat.id].aggsis your own custom format so you will need your own parser to read it and traverse object accordingly