All Downloads are FREE. Search and download functionalities are using the official Maven repository.

freemarker.healthcheck.avg-date-histogram.ftl Maven / Gradle / Ivy

There is a newer version: 1.14.0
Show newest version
<#ftl output_format="JSON">
{
  "size" : 0,
  "query" : {
    "bool" : {
      "filter" : [
        {
          "term" : {
            "api" : {
              "value" : "${query.root().id()}"
            }
          }
        }
      ],
      "disable_coord" : false,
      "adjust_pure_negative" : true
    }
  },
  "aggregations" : {
    "by_date" : {
      "date_histogram" : {
        "field" : "@timestamp",
        "interval": "${query.timeRange().interval().toMillis()}ms",
        "order" : {
          "_key" : "asc"
        },
        "keyed" : false,
        "min_doc_count" : 0,
        "extended_bounds" : {
          "min" : ${query.timeRange().range().from()},
          "max" : ${query.timeRange().range().to()}
        }
      }
<#if query.aggregations()?has_content>
      ,
      "aggregations": {
  <#list query.aggregations() as aggregation>
    <#switch aggregation.type()>
      <#case "AVG">
      "avg_${aggregation.field()}": {
        "avg": {
          "field": "${aggregation.field()}"
        }
      }
        <#break>
      <#case "FIELD">
      "by_${aggregation.field()}": {
        "terms": {
          "field": "${aggregation.field()}"
        }
      }
        <#break>
      <#default>
        <#break>
    
    <#sep>,
  
      }

    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy