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

rest-api-spec.test.search.aggregation.330_auto_date_histogram.yml Maven / Gradle / Ivy

There is a newer version: 2.18.0
Show newest version
setup:
  - do:
      indices.create:
          index: test
          body:
            settings:
              number_of_shards: 1
              number_of_replicas: 0
            mappings:
              properties:
                date:
                  type: date
  - do:
      bulk:
        refresh: true
        index: test
        body:
            - '{"index": {}}'
            - '{"date": "2020-03-01", "v": 1}'
            - '{"index": {}}'
            - '{"date": "2020-03-02", "v": 2}'
            - '{"index": {}}'
            - '{"date": "2020-03-08", "v": 3}'
            - '{"index": {}}'
            - '{"date": "2020-03-09", "v": 4}'

---
"basic":
  - skip:
      version: " - 7.8.99"
      reason:  interval had a in bug before 7.9.0
  - do:
      search:
        rest_total_hits_as_int: true
        body:
          size: 0
          aggs:
            histo:
              auto_date_histogram:
                field: date
                buckets: 2
  - match: { hits.total: 4 }
  - length: { aggregations.histo.buckets: 2 }
  - match: { aggregations.histo.interval: "7d" }
  - match: { aggregations.histo.buckets.0.key_as_string: "2020-03-01T00:00:00.000Z" }
  - match: { aggregations.histo.buckets.0.doc_count: 2 }
  - match: { aggregations.histo.buckets.1.key_as_string: "2020-03-08T00:00:00.000Z" }
  - match: { aggregations.histo.buckets.1.doc_count: 2 }

---
"avg_bucket":
  - skip:
      version: " - 7.7.99"
      reason: Fixed in 7.8.0
  - do:
      search:
        body:
          size: 0
          aggs:
            histo:
              auto_date_histogram:
                field: date
                buckets: 2
              aggs:
                v:
                  sum:
                    field: v
            histo_avg_v:
              avg_bucket:
                buckets_path: histo.v
  - match: { hits.total.value: 4 }
  - length: { aggregations.histo.buckets: 2 }
  - match: { aggregations.histo.buckets.0.key_as_string: "2020-03-01T00:00:00.000Z" }
  - match: { aggregations.histo.buckets.0.doc_count: 2 }
  - match: { aggregations.histo.buckets.0.v.value: 3 }
  - match: { aggregations.histo.buckets.1.key_as_string: "2020-03-08T00:00:00.000Z" }
  - match: { aggregations.histo.buckets.1.doc_count: 2 }
  - match: { aggregations.histo.buckets.1.v.value: 7 }
  - match: { aggregations.histo_avg_v.value: 5 }

---
"profile at top level":
  - skip:
      version: " - 7.99.99"
      reason: Debug information added in 8.0.0 (to be backported to 7.9.0)

  - do:
      search:
        body:
          profile: true
          size: 0
          aggs:
            histo:
              auto_date_histogram:
                field: date
                buckets: 2

  - match: { hits.total.value: 4 }
  - length: { aggregations.histo.buckets: 2 }
  - match: { profile.shards.0.aggregations.0.type: AutoDateHistogramAggregator.FromSingle }
  - match: { profile.shards.0.aggregations.0.debug.surviving_buckets: 4 }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy