It's much better to ditch the
compare condition here and go with the
script condition if you want to compare to response values of the a search input.
Also note that the paths you are referring to, do not match with your configured chain input. The names of the the inputs are
second respectively, which can be anything, but those names need to be used to refer to them.
In addition, the output of an aggregation includes an
array of buckets, so you cannot directly address the keys. The example below checks if the first two buckets are equal - this may or may not be what you are after.
"source" : "return ctx.payload.first.aggregations.local.buckets.key == ctx.payload.second.aggregations.tbc1.buckets.key"
If you take a step back and explain your use case a bit more detailed (without any mention of Elasticsearch, just the problem you are trying to solve), we might come with a completely different solution than this one, as I am not sure it fits every case (like comparing only the first output of the aggregation buckets).
Hope this helps!