Skip to content

Add REST tests for value_count, stats, extended_stats and cardinality aggs #26239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ setup:
settings:
number_of_replicas: 0
mappings:
test:
doc:
properties:
int_field:
type : integer
Expand All @@ -21,28 +21,28 @@ setup:
body:
- index:
_index: test_1
_type: test
_type: doc
_id: 1
- int_field: 1
double_field: 1.0
string_field: foo
- index:
_index: test_1
_type: test
_type: doc
_id: 2
- int_field: 51
double_field: 51.0
string_field: foo
- index:
_index: test_1
_type: test
_type: doc
_id: 3
- int_field: 101
double_field: 101.0
string_field: foo
- index:
_index: test_1
_type: test
_type: doc
_id: 4
- int_field: 151
double_field: 151.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,48 @@ setup:
settings:
number_of_replicas: 0
mappings:
test:
doc:
properties:
int_field:
type : integer
double_field:
type : double
string_field:
type: keyword

- do:
bulk:
refresh: true
body:
- index:
_index: test_1
_type: test
_type: doc
_id: 1
- int_field: 1
double_field: 1.0
string_field: foo
- index:
_index: test_1
_type: test
_type: doc
_id: 2
- int_field: 51
double_field: 51.0
string_field: foo
- index:
_index: test_1
_type: test
_type: doc
_id: 3
- int_field: 101
double_field: 101.0
string_field: foo
- index:
_index: test_1
_type: test
_type: doc
_id: 4
- int_field: 151
double_field: 151.0
string_field: foo

---
"Basic test":

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,48 @@ setup:
settings:
number_of_replicas: 0
mappings:
test:
doc:
properties:
int_field:
type : integer
double_field:
type : double
string_field:
type: keyword

- do:
bulk:
refresh: true
body:
- index:
_index: test_1
_type: test
_type: doc
_id: 1
- int_field: 1
double_field: 1.0
string_field: foo
- index:
_index: test_1
_type: test
_type: doc
_id: 2
- int_field: 51
double_field: 51.0
string_field: foo
- index:
_index: test_1
_type: test
_type: doc
_id: 3
- int_field: 101
double_field: 101.0
string_field: foo
- index:
_index: test_1
_type: test
_type: doc
_id: 4
- int_field: 151
double_field: 151.0
string_field: foo

---
"Basic test":

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,48 @@ setup:
settings:
number_of_replicas: 0
mappings:
test:
doc:
properties:
int_field:
type : integer
double_field:
type : double
string_field:
type: keyword

- do:
bulk:
refresh: true
body:
- index:
_index: test_1
_type: test
_type: doc
_id: 1
- int_field: 1
double_field: 1.0
string_field: foo
- index:
_index: test_1
_type: test
_type: doc
_id: 2
- int_field: 51
double_field: 51.0
string_field: foo
- index:
_index: test_1
_type: test
_type: doc
_id: 3
- int_field: 101
double_field: 101.0
string_field: foo
- index:
_index: test_1
_type: test
_type: doc
_id: 4
- int_field: 151
double_field: 151.0
string_field: foo

---
"Basic test":

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
setup:
- do:
indices.create:
index: test_1
body:
settings:
number_of_replicas: 0
mappings:
doc:
properties:
int_field:
type : integer
double_field:
type : double
string_field:
type: keyword

- do:
bulk:
refresh: true
body:
- index:
_index: test_1
_type: doc
_id: 1
- int_field: 1
double_field: 1.0
string_field: foo
- index:
_index: test_1
_type: doc
_id: 2
- int_field: 51
double_field: 51.0
string_field: foo
- index:
_index: test_1
_type: doc
_id: 3
- int_field: 101
double_field: 101.0
string_field: foo
- index:
_index: test_1
_type: doc
_id: 4
- int_field: 151
double_field: 151.0
string_field: foo

---
"Basic test":

- do:
search:
body:
aggs:
the_int_value_count:
value_count:
field: int_field
the_double_value_count:
value_count:
field: double_field
the_string_value_count:
value_count:
field: string_field

- match: { hits.total: 4 }
- length: { hits.hits: 4 }
- match: { aggregations.the_int_value_count.value: 4 }
- match: { aggregations.the_double_value_count.value: 4 }
- match: { aggregations.the_string_value_count.value: 4 }

---
"Only aggs test":

- do:
search:
body:
size: 0
aggs:
the_int_value_count:
value_count:
field: int_field
the_double_value_count:
value_count:
field: double_field
the_string_value_count:
value_count:
field: string_field

- match: { hits.total: 4 }
- length: { hits.hits: 0 }
- match: { aggregations.the_int_value_count.value: 4 }
- match: { aggregations.the_double_value_count.value: 4 }
- match: { aggregations.the_string_value_count.value: 4 }

---
"Filtered test":

- do:
search:
body:
query:
constant_score:
filter:
range:
int_field:
gte: 50
aggs:
the_int_value_count:
value_count:
field: int_field
the_double_value_count:
value_count:
field: double_field
the_string_value_count:
value_count:
field: string_field

- match: { hits.total: 3 }
- length: { hits.hits: 3 }
- match: { aggregations.the_int_value_count.value: 3 }
- match: { aggregations.the_double_value_count.value: 3 }
- match: { aggregations.the_string_value_count.value: 3 }


---
"Missing field with missing param":

- do:
search:
body:
aggs:
the_missing_value_count:
value_count:
field: foo
missing: 1

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

---
"Missing field without missing param":

- do:
search:
body:
aggs:
the_missing_value_count:
value_count:
field: foo

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

---
"Metadata test":

- do:
search:
body:
aggs:
the_int_value_count:
meta:
foo: bar
value_count:
field: int_field

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