I translate this elastic query sql
POST _sql?translate { "query": "SELECT HISTOGRAM(\"@timestamp\", INTERVAL 1 MONTH) AS month, count(DISTINCT(ID)) as id_count, report_period FROM \"indexname-*\" WHERE \"@timestamp\" BETWEEN '2019-01-02T00:00:00.000Z' AND '2020-07-30T00:00:00.000Z' GROUP BY month,report_period" }
`{
"size" : 0,
"query" : {
"bool" : {
"must" : [
{
"bool" : {"adjust_pure_negative" : true, "boost" : 1.0 } }, { "range" : { "@timestamp" : { "from" : "2019-01-02T00:00:00.000Z", "to" : "2020-07-30T00:00:00.000Z", "include_lower" : true, "include_upper" : true, "boost" : 1.0 } } } ], "adjust_pure_negative" : true, "boost" : 1.0 }
},
"_source" : false,
"stored_fields" : "none",
"aggregations" : {
"groupby" : {
"composite" : {
"size" : 1000,
"sources" : [
{
"ae2cae7b" : {
"date_histogram" : {
"field" : "@timestamp",
"missing_bucket" : true,
"value_type" : "date",
"order" : "asc",
"fixed_interval" : "2592000000ms",
"time_zone" : "Z"
}
}
},
{
"4557ce61" : {
"terms" : {
"field" : "report_period",
"missing_bucket" : true,
"order" : "asc"
}}
}
It generates me the table perfectly with the aggregation , I am trying to write into a dataframe , where I can fetch all the fields present in elastic , but couldnt fetch the id_count queried from the sql statement.