-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reverted accidental overwrite of 370 test; added doc_count test as 380
Signed-off-by: Petar Dzepina <petar.dzepina@gmail.com>
- Loading branch information
Showing
2 changed files
with
147 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
146 changes: 146 additions & 0 deletions
146
...api-spec/src/main/resources/rest-api-spec/test/search.aggregation/380_doc_count_field.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
setup: | ||
- do: | ||
indices.create: | ||
index: test_1 | ||
body: | ||
settings: | ||
number_of_replicas: 0 | ||
mappings: | ||
properties: | ||
str: | ||
type: keyword | ||
number: | ||
type: integer | ||
|
||
- do: | ||
bulk: | ||
index: test_1 | ||
refresh: true | ||
body: | ||
- '{"index": {}}' | ||
- '{"_doc_count": 10, "str": "abc", "number" : 500, "unmapped": "abc" }' | ||
- '{"index": {}}' | ||
- '{"_doc_count": 5, "str": "xyz", "number" : 100, "unmapped": "xyz" }' | ||
- '{"index": {}}' | ||
- '{"_doc_count": 7, "str": "foo", "number" : 100, "unmapped": "foo" }' | ||
- '{"index": {}}' | ||
- '{"_doc_count": 1, "str": "foo", "number" : 200, "unmapped": "foo" }' | ||
- '{"index": {}}' | ||
- '{"str": "abc", "number" : 500, "unmapped": "abc" }' | ||
|
||
--- | ||
"Test numeric terms agg with doc_count": | ||
- skip: | ||
version: "1.0.0 - " | ||
reason: "until this is released and we know exact version" | ||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
body: { "size" : 0, "aggs" : { "num_terms" : { "terms" : { "field" : "number" } } } } | ||
|
||
- match: { hits.total: 5 } | ||
- length: { aggregations.num_terms.buckets: 3 } | ||
- match: { aggregations.num_terms.buckets.0.key: 100 } | ||
- match: { aggregations.num_terms.buckets.0.doc_count: 12 } | ||
- match: { aggregations.num_terms.buckets.1.key: 500 } | ||
- match: { aggregations.num_terms.buckets.1.doc_count: 11 } | ||
- match: { aggregations.num_terms.buckets.2.key: 200 } | ||
- match: { aggregations.num_terms.buckets.2.doc_count: 1 } | ||
|
||
--- | ||
"Test keyword terms agg with doc_count": | ||
- skip: | ||
version: "1.0.0 - " | ||
reason: "until this is released and we know exact version" | ||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
body: { "size" : 0, "aggs" : { "str_terms" : { "terms" : { "field" : "str" } } } } | ||
|
||
- match: { hits.total: 5 } | ||
- length: { aggregations.str_terms.buckets: 3 } | ||
- match: { aggregations.str_terms.buckets.0.key: "abc" } | ||
- match: { aggregations.str_terms.buckets.0.doc_count: 11 } | ||
- match: { aggregations.str_terms.buckets.1.key: "foo" } | ||
- match: { aggregations.str_terms.buckets.1.doc_count: 8 } | ||
- match: { aggregations.str_terms.buckets.2.key: "xyz" } | ||
- match: { aggregations.str_terms.buckets.2.doc_count: 5 } | ||
|
||
--- | ||
"Test unmapped string terms agg with doc_count": | ||
- skip: | ||
version: "1.0.0 - " | ||
reason: "until this is released and we know exact version" | ||
- do: | ||
bulk: | ||
index: test_2 | ||
refresh: true | ||
body: | ||
- '{"index": {}}' | ||
- '{"_doc_count": 10, "str": "abc" }' | ||
- '{"index": {}}' | ||
- '{"str": "abc" }' | ||
- do: | ||
search: | ||
index: test_2 | ||
rest_total_hits_as_int: true | ||
body: { "size" : 0, "aggs" : { "str_terms" : { "terms" : { "field" : "str.keyword" } } } } | ||
|
||
- match: { hits.total: 2 } | ||
- length: { aggregations.str_terms.buckets: 1 } | ||
- match: { aggregations.str_terms.buckets.0.key: "abc" } | ||
- match: { aggregations.str_terms.buckets.0.doc_count: 11 } | ||
|
||
--- | ||
"Test composite str_terms agg with doc_count": | ||
- skip: | ||
version: "1.0.0 - " | ||
reason: "until this is released and we know exact version" | ||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
body: { "size" : 0, "aggs" : | ||
{ "composite_agg" : { "composite" : | ||
{ | ||
"sources": ["str_terms": { "terms": { "field": "str" } }] | ||
} | ||
} | ||
} | ||
} | ||
|
||
- match: { hits.total: 5 } | ||
- length: { aggregations.composite_agg.buckets: 3 } | ||
- match: { aggregations.composite_agg.buckets.0.key.str_terms: "abc" } | ||
- match: { aggregations.composite_agg.buckets.0.doc_count: 11 } | ||
- match: { aggregations.composite_agg.buckets.1.key.str_terms: "foo" } | ||
- match: { aggregations.composite_agg.buckets.1.doc_count: 8 } | ||
- match: { aggregations.composite_agg.buckets.2.key.str_terms: "xyz" } | ||
- match: { aggregations.composite_agg.buckets.2.doc_count: 5 } | ||
|
||
--- | ||
"Test composite num_terms agg with doc_count": | ||
- skip: | ||
version: "1.0.0 - " | ||
reason: "until this is released and we know exact version" | ||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
body: { "size" : 0, "aggs" : | ||
{ "composite_agg" : | ||
{ "composite" : | ||
{ | ||
"sources": ["num_terms" : { "terms" : { "field" : "number" } }] | ||
} | ||
} | ||
} | ||
} | ||
|
||
- match: { hits.total: 5 } | ||
- length: { aggregations.composite_agg.buckets: 3 } | ||
- match: { aggregations.composite_agg.buckets.0.key.num_terms: 100 } | ||
- match: { aggregations.composite_agg.buckets.0.doc_count: 12 } | ||
- match: { aggregations.composite_agg.buckets.1.key.num_terms: 200 } | ||
- match: { aggregations.composite_agg.buckets.1.doc_count: 1 } | ||
- match: { aggregations.composite_agg.buckets.2.key.num_terms: 500 } | ||
- match: { aggregations.composite_agg.buckets.2.doc_count: 11 } |