I've got a complex nested aggregation that uses a serial_diff as final step to produce a new field. This field contains the information I want to visualise.
Unfortunately I can't get top_hits to recognise the field created by serial_diff, is there a way to specify that path or will I have to calculate the top_hits myself on the client side? (Any pseudo code? )
Thanks!
The query looks something like:
POST /index/type/_search
{
"size": 0,
"query": {...
},
"aggs": {
"agg1": {
"terms": {
"field": "field1.raw",
"size": 0
},
"aggs": {
"agg2": {
"terms": {
"field": "field2.raw",
"size": 0
},
"aggs": {
"timechart": {
"date_histogram": {
...
},
"aggs": {
"max_field_of_interest": {
"max": {
"field": "field_of_interest"
}
},
"usable_value": {
"serial_diff": {
"buckets_path": "max_field_of_interest",
"lag": 1
},
"aggs": {
"top_results": {
"top_hits": {
"sort": [
{
"usable_value": {
"order": "desc"
}
}
],
"size" : 10
}
...
}