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

rest-api-spec.test.search.aggregation.110_max_metric_unsigned.yml Maven / Gradle / Ivy

The newest version!
setup:
  - skip:
      version: " - 2.7.99"
      reason: unsigned_long is not supported before 2.8.0

  - do:
      indices.create:
          index: test_1
          body:
            settings:
              number_of_replicas: 0
            mappings:
              properties:
                unsigned_field:
                   type : unsigned_long
                double_field:
                   type : double
                string_field:
                   type: keyword

  - do:
       bulk:
         refresh: true
         body:
           - index:
               _index: test_1
               _id:    1
           - unsigned_field: 1
             double_field: 1.0
             string_field: foo
           - index:
               _index: test_1
               _id:    2
           - unsigned_field: 51
             double_field: 51.0
             string_field: foo
           - index:
               _index: test_1
               _id:    3
           - unsigned_field: 101
             double_field: 101.0
             string_field: foo
           - index:
               _index: test_1
               _id:    4
           - unsigned_field: 10223372036854778000
             double_field: 10223372036854778000.0
             string_field: foo

---
"Basic test":

  - do:
      search:
        rest_total_hits_as_int: true
        body:
          aggs:
            the_unsigned_avg:
              avg:
                field: unsigned_field
            the_double_avg:
              avg:
                field: double_field

  - match: { hits.total: 4 }
  - length: { hits.hits: 4 }
  - match: { aggregations.the_unsigned_avg.value: 2555843009213694500.0 }
  - match: { aggregations.the_double_avg.value: 2555843009213694500.0 }

---
"Only aggs test":

  - do:
      search:
        rest_total_hits_as_int: true
        body:
          size: 0
          aggs:
            the_unsigned_avg:
              avg:
                field: unsigned_field
            the_double_avg:
              avg:
                field: double_field

  - match: { hits.total: 4 }
  - length: { hits.hits: 0 }
  - match: { aggregations.the_unsigned_avg.value: 2555843009213694500.0 }
  - match: { aggregations.the_double_avg.value: 2555843009213694500.0 }

---
"Filtered test":

  - do:
      search:
        rest_total_hits_as_int: true
        body:
          query:
            constant_score:
              filter:
                range:
                  unsigned_field:
                    gte: 50
          aggs:
            the_unsigned_avg:
              avg:
                field: unsigned_field
            the_double_avg:
              avg:
                field: double_field

  - match: { hits.total: 3 }
  - length: { hits.hits: 3 }
  - match: { aggregations.the_unsigned_avg.value: 3407790678951592400.0 }
  - match: { aggregations.the_double_avg.value: 3407790678951592400.0 }


---
"Missing field with missing param":

  - do:
      search:
        rest_total_hits_as_int: true
        body:
          aggs:
            the_missing_avg:
              avg:
                field: foo
                missing: 1

  - match: { hits.total: 4 }
  - length: { hits.hits: 4 }
  - match: { aggregations.the_missing_avg.value: 1 }

---
"Missing field without missing param":

  - do:
      search:
        rest_total_hits_as_int: true
        body:
          aggs:
            the_missing_avg:
              avg:
                field: foo

  - match: { hits.total: 4 }
  - length: { hits.hits: 4 }
  - is_false: aggregations.the_missing_avg.value

---
"Metadata test":

  - do:
      search:
        rest_total_hits_as_int: true
        body:
          aggs:
            the_unsigned_avg:
              meta:
                foo: bar
              avg:
                field: unsigned_field

  - match: { hits.total: 4 }
  - length: { hits.hits: 4 }
  - match: { aggregations.the_unsigned_avg.value: 2555843009213694500.0 }
  - match: { aggregations.the_unsigned_avg.meta.foo: "bar" }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy