Histogram in reverse nested

Data format:

Basically i want to do the aggregation with histogram for 4 minutes.

  1. The pattern was:

1st min send 2 requests from each port
2nd min send 3 requests from each port
3rd min send 4 requests from each port
4th min send 5 requests from each port

{
..........
"aggregations": {
"clientPorttopKByCount.key": {
  "nested": {
    "path": "clientPorttopKByCount"
  },
  "aggregations": {
    "orders": {
      "terms": {
        "field": "clientPorttopKByCount.key",
        "size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": [
          {
            "_count": "desc"
          },
          {
            "_key": "asc"
          }
        ]
       },    
    "aggregations": {
        "records": {
          "reverse_nested": {
            
          },
          "aggregations": {
            "histogram": {
              "histogram": {
                "field": "timestamp",
                "interval": 60000.0,
                "offset": 0.0,
                "order": {
                  "_key": "asc"
                },
                "keyed": false,
                "min_doc_count": 0
              },
              "aggregations": {
                "clientPorttopKByCount.key": {
                  "nested": {
                    "path": "clientPorttopKByCount"
                  },
                  "aggregations": {
                    "clientPorttopKByCount.value_sum": {
                      "sum": {
                        "field": "clientPorttopKByCount.value"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

}
}

and the response is :

Expected is:

Problem is, it is summing all the ports value to the each minute.

Please help me to solve this.

Request is:

   {
    ..................
  "aggregations": {
  "clientPorttopKByCount.key": {
  "nested": {
    "path": "clientPorttopKByCount"
  },
  "aggregations": {
    "orders": {
      "terms": {
        "field": "clientPorttopKByCount.key",
        "size": 5000,
        "min_doc_count": 1,
        "shard_min_doc_count": 0,
        "show_term_doc_count_error": false,
        "order": [
          {
            "_count": "desc"
          },
          {
            "_key": "asc"
          }
        ]
      },
      "aggregations": {
        "records": {
          "reverse_nested": {
            
          },
          "aggregations": {
            "histogram": {
              "histogram": {
                "field": "timestamp",
                "interval": 60000.0,
                "offset": 0.0,
                "order": {
                  "_key": "asc"
                },
                "keyed": false,
                "min_doc_count": 0
              },
              "aggregations": {
                "clientPorttopKByCount.key": {
                  "nested": {
                    "path": "clientPorttopKByCount"
                  },
                  "aggregations": {
                    "clientPorttopKByCount.value_sum": {
                      "sum": {
                        "field": "clientPorttopKByCount.value"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
}
.......
} 

Can some please guide me, I am blocked.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.