Is it possible to make a terms aggregation on a scripted field which isn't the root? Kibana's terms aggregation demands choosing a field. Maybe when a script is provided (through input JSON or through a dedicated field), there should be a support when choosing a field to find the relevant nested level.
{
"aggs" : {
"myNested" : {
"path" : "Cars"
},
"aggs" : {
"MyTerms" : {
"terms" : {
"script" : {
"source" : "doc['Cars.Type'].value + '-' + doc['Cars.Model'].value",
"lang" : "painless"
}
}
}
}
}
}
This support seems (to me) very related to issue #89. In both issues, the field is specified only in order to drill down into the desired nested level.
Implementation details:
- The same key of
field might be confusing. How can the plugin know whether to make a terms aggregation on the specified field or just to drill down into it? I think it's best to make a new type of aggregation called Terms Script Aggregation, which is different from the regular Terms Aggregation.
- Another decision would be whether to include a parameter named
source or just to include the script in the input JSON. I think the latter option is far more flexible.
Kibana version: 5.6.10.
Is it possible to make a terms aggregation on a scripted field which isn't the root? Kibana's terms aggregation demands choosing a field. Maybe when a script is provided (through input JSON or through a dedicated field), there should be a support when choosing a field to find the relevant nested level.
This support seems (to me) very related to issue #89. In both issues, the field is specified only in order to drill down into the desired nested level.
Implementation details:
fieldmight be confusing. How can the plugin know whether to make a terms aggregation on the specified field or just to drill down into it? I think it's best to make a new type of aggregation calledTerms Script Aggregation, which is different from the regularTerms Aggregation.sourceor just to include the script in the input JSON. I think the latter option is far more flexible.Kibana version: 5.6.10.