2014-07-17 04:05:43 -04:00
|
|
|
setup:
|
|
|
|
- do:
|
|
|
|
indices.create:
|
|
|
|
index: test_1
|
|
|
|
body:
|
2014-07-21 16:41:15 -04:00
|
|
|
settings:
|
|
|
|
number_of_replicas: 0
|
2014-07-17 04:05:43 -04:00
|
|
|
mappings:
|
|
|
|
test:
|
|
|
|
"properties":
|
|
|
|
"number":
|
|
|
|
"type" : "integer"
|
|
|
|
- do:
|
|
|
|
cluster.health:
|
|
|
|
wait_for_status: green
|
|
|
|
|
2014-07-11 06:36:57 -04:00
|
|
|
---
|
|
|
|
"Basic test":
|
|
|
|
- do:
|
|
|
|
index:
|
|
|
|
index: test_1
|
|
|
|
type: test
|
|
|
|
id: 1
|
|
|
|
body: { "number" : 1 }
|
|
|
|
|
|
|
|
- do:
|
|
|
|
index:
|
|
|
|
index: test_1
|
|
|
|
type: test
|
|
|
|
id: 2
|
|
|
|
body: { "number" : 51 }
|
|
|
|
|
|
|
|
- do:
|
|
|
|
index:
|
|
|
|
index: test_1
|
|
|
|
type: test
|
|
|
|
id: 3
|
|
|
|
body: { "number" : 101 }
|
|
|
|
|
|
|
|
- do:
|
|
|
|
index:
|
|
|
|
index: test_1
|
|
|
|
type: test
|
|
|
|
id: 4
|
|
|
|
body: { "number" : 151 }
|
|
|
|
|
|
|
|
- do:
|
|
|
|
indices.refresh: {}
|
|
|
|
|
|
|
|
- do:
|
|
|
|
search:
|
|
|
|
body: { "aggs" : { "histo" : { "histogram" : { "field" : "number", "interval" : 50 } } } }
|
|
|
|
|
|
|
|
- match: { hits.total: 4 }
|
|
|
|
|
|
|
|
- length: { aggregations.histo.buckets: 4 }
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.0.key: 0 }
|
|
|
|
|
|
|
|
- is_false: aggregations.histo.buckets.0.key_as_string
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.0.doc_count: 1 }
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.1.key: 50 }
|
|
|
|
|
|
|
|
- is_false: aggregations.histo.buckets.1.key_as_string
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.1.doc_count: 1 }
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.2.key: 100 }
|
|
|
|
|
|
|
|
- is_false: aggregations.histo.buckets.2.key_as_string
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.2.doc_count: 1 }
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.3.key: 150 }
|
|
|
|
|
|
|
|
- is_false: aggregations.histo.buckets.3.key_as_string
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.3.doc_count: 1 }
|
|
|
|
|
|
|
|
---
|
|
|
|
"Format test":
|
|
|
|
- do:
|
|
|
|
index:
|
|
|
|
index: test_1
|
|
|
|
type: test
|
|
|
|
id: 1
|
|
|
|
body: { "number" : 1 }
|
|
|
|
|
|
|
|
- do:
|
|
|
|
index:
|
|
|
|
index: test_1
|
|
|
|
type: test
|
|
|
|
id: 2
|
|
|
|
body: { "number" : 51 }
|
|
|
|
|
|
|
|
- do:
|
|
|
|
index:
|
|
|
|
index: test_1
|
|
|
|
type: test
|
|
|
|
id: 3
|
|
|
|
body: { "number" : 101 }
|
|
|
|
|
|
|
|
- do:
|
|
|
|
index:
|
|
|
|
index: test_1
|
|
|
|
type: test
|
|
|
|
id: 4
|
|
|
|
body: { "number" : 151 }
|
|
|
|
|
|
|
|
- do:
|
|
|
|
indices.refresh: {}
|
|
|
|
|
|
|
|
- do:
|
|
|
|
search:
|
|
|
|
body: { "aggs" : { "histo" : { "histogram" : { "field" : "number", "interval" : 50, "format" : "Value is ##0.0" } } } }
|
|
|
|
|
|
|
|
- match: { hits.total: 4 }
|
|
|
|
|
|
|
|
- length: { aggregations.histo.buckets: 4 }
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.0.key: 0 }
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.0.key_as_string: "Value is 0.0" }
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.0.doc_count: 1 }
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.1.key: 50 }
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.1.key_as_string: "Value is 50.0" }
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.1.doc_count: 1 }
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.2.key: 100 }
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.2.key_as_string: "Value is 100.0" }
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.2.doc_count: 1 }
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.3.key: 150 }
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.3.key_as_string: "Value is 150.0" }
|
|
|
|
|
|
|
|
- match: { aggregations.histo.buckets.3.doc_count: 1 }
|